digital_ocean – Create/delete a droplet/SSH_key in DigitalOcean¶
DEPRECATED¶
- Removed in Ansible
version: 2.12
- Why
Updated module to remove external dependency with increased functionality.
- Alternative
Use digital_ocean_droplet instead.
Synopsis¶
Create/delete a droplet in DigitalOcean and optionally wait for it to be ‘running’, or deploy an SSH key.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.6
dopy
Parameters¶
Notes¶
Note
Two environment variables can be used, DO_API_KEY and DO_API_TOKEN. They both refer to the v2 token.
As of Ansible 1.9.5 and 2.0, Version 2 of the DigitalOcean API is used, this removes
client_id
andapi_key
options in favor ofapi_token
.If you are running Ansible 1.9.4 or earlier you might not be able to use the included version of this module as the API version used has been retired. Upgrade Ansible or, if unable to, try downloading the latest version of this module from github and putting it into a ‘library’ directory.
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...'
api_token: XXX
# Create a new Droplet
# Will return the droplet details including the droplet id (used for idempotence)
- digital_ocean:
state: present
command: droplet
name: mydroplet
api_token: XXX
size_id: 2gb
region_id: ams2
image_id: fedora-19-x64
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: mydroplet
api_token: XXX
size_id: 2gb
region_id: ams2
image_id: fedora-19-x64
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: 123,456
name: mydroplet
api_token: XXX
size_id: 2gb
region_id: ams2
image_id: fedora-19-x64
Status¶
This module will be removed in version 2.12. [deprecated]
For more information see DEPRECATED.
Authors¶
Vincent Viallet (@zbal)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.