jasonheecs.digitalocean

Ansible Role: Creating DigitalOcean Droplets

Build Status Galaxy Role

This is an Ansible role that sets up a DigitalOcean droplet and adds the droplet's IP address to your inventory file.

Requirements

None.

Installation

To install, run:

ansible-galaxy install jasonheecs.digitalocean

Role Variables

You can find role variables in defaults/main.yml. Store sensitive items like your DigitalOcean API token in vars/private.yml.

Here are some available variables along with their default values (check defaults/main.yml and vars/private.yml.example for more details):

# SSH Key identifier in your DigitalOcean account
do_ssh_key_name: Ansible SSH Key
# Public SSH key to add to your account
do_ssh_pub_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
# Private key to SSH into your droplet
do_ssh_private_key: "~/.ssh/id_rsa"

# Name of the droplet
droplet_name: test-droplet
# Region for the droplet
droplet_region_id: sgp1
# Size of the droplet
droplet_size_id: 512mb
# Image for the droplet
droplet_image_id: ubuntu-18-04-x64

# Location of your ansible inventory file
ansible_inventory_file: hosts.ini
# Group name for organizing droplets in your inventory
droplets_inventory_group: do_droplets

# Your DigitalOcean Personal Access Token 
do_api_token: inserttokenhere
# Extra SSH Keys to add during droplet creation
droplet_additional_ssh_key_ids: []

Dependencies

None.

Example Playbooks

A playbook to run this role on a remote machine:

- hosts: all
  become: no
  roles:
    - { role: jasonheecs.digitalocean }

A playbook to run this role on your local machine:

- hosts: localhost
  connection: local
  become: no
  roles:
    - { role: jasonheecs.digitalocean }

You can check a sample playbook here.

Tests

Automated testing is performed using Test Kitchen, Kitchen Ansible, and Kitchen Docker.

To run the tests, make sure you have Ruby and Docker installed, then execute:

gem install bundler && bundle exec kitchen test

Refer to the travis.yml file and Travis build logs for more information about the test build process and outputs.

Supported Platforms

This Ansible role works well on these platforms:

  • macOS Sierra
  • macOS High Sierra
  • Ubuntu 16.04
  • Ubuntu 14.04
  • CentOS 7
  • Debian 9

License

MIT

Author Information

Jason Hee

Informazioni sul progetto

Create DigitalOcean droplet via Ansible

Installa
ansible-galaxy install jasonheecs.digitalocean
Licenza
mit
Download
1.4k
Proprietario