community.digitalocean.digital_ocean_block_storage – Create/destroy or attach/detach Block Storage volumes in DigitalOcean¶
Note
This plugin is part of the community.digitalocean collection (version 1.0.0).
To install it use: ansible-galaxy collection install community.digitalocean
.
To use it in a playbook, specify: community.digitalocean.digital_ocean_block_storage
.
Synopsis¶
Create/destroy Block Storage volume in DigitalOcean, or attach/detach Block Storage volume to a droplet.
Parameters¶
Notes¶
Note
Two environment variables can be used, DO_API_KEY and DO_API_TOKEN. They both refer to the v2 token.
If snapshot_id is used, region and block_size will be ignored and changed to null.
Examples¶
- name: Create new Block Storage
community.digitalocean.digital_ocean_block_storage:
state: present
command: create
api_token: <TOKEN>
region: nyc1
block_size: 10
volume_name: nyc1-block-storage
- name: Delete Block Storage
community.digitalocean.digital_ocean_block_storage:
state: absent
command: create
api_token: <TOKEN>
region: nyc1
volume_name: nyc1-block-storage
- name: Attach Block Storage to a Droplet
community.digitalocean.digital_ocean_block_storage:
state: present
command: attach
api_token: <TOKEN>
volume_name: nyc1-block-storage
region: nyc1
droplet_id: <ID>
- name: Detach Block Storage from a Droplet
community.digitalocean.digital_ocean_block_storage:
state: absent
command: attach
api_token: <TOKEN>
volume_name: nyc1-block-storage
region: nyc1
droplet_id: <ID>
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
id
string
|
changed |
Unique identifier of a Block Storage volume returned during creation.
Sample:
69b25d9a-494c-12e6-a5af-001f53126b44
|
Authors¶
Harnek Sidhu (@harneksidhu)