New in version 2.2.
Create/destroy Block Storage volume in DigitalOcean, or attach/detach Block Storage volume to a droplet.
parameter | required | default | choices | comments |
---|---|---|---|---|
api_token | yes | DigitalOcean api token. |
||
block_size | no | The size of the Block Storage volume in gigabytes. Required when command=create and state=present. |
||
command | yes |
| Which operation do you want to perform. |
|
description | no | Description of the Block Storage volume. |
||
droplet_id | no | The droplet id you want to operate on. Required when command=attach. |
||
region | yes | The slug of the region where your Block Storage volume should be located in. |
||
state | yes |
| Indicate desired state of the target. |
|
timeout | no | 10 | The timeout in seconds used for polling DigitalOcean's API. |
|
volume_name | yes | The name of the Block Storage volume. |
# Create new Block Storage - digital_ocean_block_storage: state: present command: create api_token: <TOKEN> region: nyc1 block_size: 10 volume_name: nyc1-block-storage # Delete Block Storage - digital_ocean_block_storage: state: absent command: create api_token: <TOKEN> region: nyc1 volume_name: nyc1-block-storage # Attach Block Storage to a Droplet - digital_ocean_block_storage: state: present command: attach api_token: <TOKEN> volume_name: nyc1-block-storage region: nyc1 droplet_id: <ID> # Detach Block Storage from a Droplet - digital_ocean_block_storage: state: absent command: attach api_token: <TOKEN> volume_name: nyc1-block-storage region: nyc1 droplet_id: <ID>
Common return values are documented here Common Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
id | Unique identifier of a Block Storage volume returned during creation. | changed | string | 69b25d9a-494c-12e6-a5af-001f53126b44 |
Note
Two environment variables can be used, DO_API_KEY and DO_API_TOKEN. They both refer to the v2 token.
For more information on what this means please read Core Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.
© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/digital_ocean_block_storage_module.html