ANSIBLE.DIGITAL_OCEAN(3)

NAME
digital_ocean - Create/delete a droplet/SSH_key in DigitalOcean

DESCRIPTION

Create/delete a droplet in DigitalOcean and optionally waits for it to be 'running', or deploy an SSH key.

OPTIONS

api_key
    Digital Ocean api key.

client_id
    Digital Ocean manager id.

command
    Which target you want to operate on. Choices: droplet,ssh. (default: droplet)

id  Numeric, the droplet id you want to operate on.

image_id
    Numeric, this is the id of the image you would like the droplet created with.

name
    String, this is the name of the droplet - must be formatted by hostname rules, or the name of a SSH key.

private_networking
    Bool, add an additional, private network interface to droplet for inter-droplet communication Choices: yes,no. (default: no)(Added in Ansible version 1.4.)

region_id
    Numeric, this is the id of the region you would like your server

size_id
    Numeric, this is the id of the size you would like the droplet created at.

ssh_key_ids
    Optional, comma separated list of ssh_key_ids that you would like to be added to the server

ssh_pub_key
    The public SSH key you want to add to your account.

state
    Indicate desired state of the target. Choices: present,active,absent,deleted. (default: present)

unique_name
    Bool, require unique hostnames. By default, digital ocean allows multiple hosts with the same name. Setting this to "yes" allows only one host per name. Useful for idempotence. Choices: yes,no. (default: no)(Added in Ansible version 1.4.)

virtio
    Bool, turn on virtio driver in droplet for improved network and storage I/O Choices: yes,no. (default: yes)(Added in Ansible version 1.4.)

wait
    Wait for the droplet to be in state 'running' before returning. If wait is "no" an ip_address may not be returned. Choices: yes,no. (default: yes)

wait_timeout
    How long before wait gives up, in seconds. (default: 300).

NOTES

Two environment variables can be used, DO_CLIENT_ID and DO_API_KEY.

EXAMPLES
# Ensure a SSH key is present
# If a key matches this name, will return the ssh key id and changed = False
# If no existing key matches this name, a new key is created, the ssh key id is returned and changed = False
- digital_ocean: >
      state=present
      command=ssh
      name=my_ssh_key
      ssh_pub_key='ssh-rsa AAAA...'
      client_id=XXX
      api_key=XXX
# Create a new Droplet
# Will return the droplet details including the droplet id (used for idempotence)
- digital_ocean: >
      state=present
      command=droplet
      name=my_new_droplet
      client_id=XXX
      api_key=XXX
      size_id=1
      region_id=2
      image_id=3
      wait_timeout=500
  register: my_droplet
- debug: msg="ID is {{ my_droplet.droplet.id }}"
- debug: msg="IP is {{ my_droplet.droplet.ip_address }}"
# Ensure a droplet is present
# If droplet id already exist, will return the droplet details and changed = False
# If no droplet matches the id, a new droplet will be created and the droplet details (including the new id) are returned, changed = True.
- digital_ocean: >
      state=present
      command=droplet
      id=123
      name=my_new_droplet
      client_id=XXX
      api_key=XXX
      size_id=1
      region_id=2
      image_id=3
      wait_timeout=500
# Create a droplet with ssh key
# The ssh key id can be passed as argument at the creation of a droplet (see ssh_key_ids).
# Several keys can be added to ssh_key_ids as id1,id2,id3
# The keys are used to connect as root to the droplet.
- digital_ocean: >
      state=present
      ssh_key_ids=id1,id2
      name=my_new_droplet
      client_id=XXX
      api_key=XXX
      size_id=1
      region_id=2
      image_id=3

SEE ALSO
ansible(1), http://ansible.github.com/modules.html#digital-ocean