New in version 2.8.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
backups boolean |
| indicates whether automated backups should be enabled. |
id - | Numeric, the droplet id you want to operate on. aliases: droplet_id | |
image - | This is the slug of the image you would like the droplet created with. aliases: image_id | |
ipv6 boolean |
| enable IPv6 for your droplet. |
monitoring boolean |
| indicates whether to install the DigitalOcean agent for monitoring. |
name - | String, this is the name of the droplet - must be formatted by hostname rules. | |
oauth_token - / required | DigitalOcean OAuth token. Can be specified in DO_API_KEY , DO_API_TOKEN , or DO_OAUTH_TOKEN environment variablesaliases: API_TOKEN | |
private_networking boolean |
| add an additional, private network interface to droplet for inter-droplet communication. |
region - | This is the slug of the region you would like your server to be created in. aliases: region_id | |
size - | This is the slug of the size you would like the droplet created with. aliases: size_id | |
ssh_keys - | array of SSH key (numeric) ID that you would like to be added to the server. | |
state - |
| Indicate desired state of the target. |
tags - | List, A list of tag names as strings to apply to the Droplet after it is created. Tag names can either be existing or new tags. | |
unique_name boolean |
| require unique hostnames. By default, DigitalOcean allows multiple hosts with the same name. Setting this to "yes" allows only one host per name. Useful for idempotence. |
user_data - | opaque blob of data which is made available to the droplet | |
volumes - | List, A list including the unique string identifier for each Block Storage volume to be attached to the Droplet. | |
wait boolean |
| Wait for the droplet to be active before returning. If wait is "no" an ip_address may not be returned. |
wait_timeout - | Default: 120 | How long before wait gives up, in seconds, when creating a droplet. |
- name: create a new droplet digital_ocean_droplet: state: present name: mydroplet oauth_token: XXX size: 2gb region: sfo1 image: ubuntu-16-04-x64 wait_timeout: 500 register: my_droplet - debug: msg: "ID is {{ my_droplet.data.droplet.id }}, IP is {{ my_droplet.data.ip_address }}" - name: ensure a droplet is present digital_ocean_droplet: state: present id: 123 name: mydroplet oauth_token: XXX size: 2gb region: sfo1 image: ubuntu-16-04-x64 wait_timeout: 500
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
data dictionary | changed | a DigitalOcean Droplet Sample: {'ip_address': '104.248.118.172', 'ipv6_address': '2604:a880:400:d1::90a:6001', 'private_ipv4_address': '10.136.122.141', 'droplet': {'id': 3164494, 'name': 'example.com', 'memory': 512, 'vcpus': 1, 'disk': 20, 'locked': True, 'status': 'new', 'kernel': {'id': 2233, 'name': 'Ubuntu 14.04 x64 vmlinuz-3.13.0-37-generic', 'version': '3.13.0-37-generic'}, 'created_at': '2014-11-14T16:36:31Z', 'features': ['virtio'], 'backup_ids': [], 'snapshot_ids': [], 'image': {}, 'volume_ids': [], 'size': {}, 'size_slug': '512mb', 'networks': {}, 'region': {}, 'tags': ['web']}} |
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/digital_ocean_droplet_module.html