Creates or deletes volumes.
View the create API documentation at https://docs.digitalocean.com/reference/api/api-reference/#operation/volumes_create.
View the delete API documentation at https://docs.digitalocean.com/reference/api/api-reference/#operation/volumes_delete_byName.
Optionally, a filesystem_type attribute may be provided in order to automatically format the volume’s filesystem.
Pre-formatted volumes are automatically mounted when attached to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS Droplets created on or after April 26, 2018.
Attaching pre-formatted volumes to Droplets without support for auto-mounting is not recommended.
Parameter | Choices | Default | Comments |
---|---|---|---|
client_override_options (dict) |
Client override options (developer use). For example, can be used to override the DigitalOcean API endpoint for an internal test suite. If provided, these options will knock out existing options. | ||
description (str) |
An optional free-form text field to describe a block storage volume. | ||
filesystem_label (str) |
The label applied to the filesystem. Labels for ext4 type filesystems may contain 16 characters while labels for xfs type filesystems are limited to 12 characters. May only be used in conjunction with filesystem_type. | ||
filesystem_type (str) |
|
The name of the filesystem type to be used on the volume. When provided, the volume will automatically be formatted to the specified filesystem type. Currently, the available options are ext4 and xfs . Pre-formatted volumes are automatically mounted when attached to Ubuntu, Debian, Fedora,
Fedora Atomic, and CentOS Droplets created on or after April 26, 2018.
Attaching pre-formatted volumes to other Droplets is not recommended. |
|
module_override_options (dict) |
Module override options (developer use). Can be used to override module options to support experimental or future options. If provided, these options will knock out existing options. | ||
name (str) |
A human-readable name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter. | ||
region (str) |
The slug identifier for the region where the resource will initially be available. | ||
size_gigabytes (int) |
The size of the block storage volume in GiB 1024^3 . |
||
snapshot_id (str) |
The unique identifier for the volume snapshot from which to create the volume. | ||
state (str) |
|
present | State of the resource, present to create, absent to destroy. |
tags (list) |
A flat array of tag names as strings to be applied to the resource. Tag names may be for either existing or new tags. | ||
timeout (int) |
300 | Polling timeout in seconds. | |
token (str) |
DigitalOcean API token. There are several environment variables which can be used to provide this value. DIGITALOCEAN_ACCESS_TOKEN , DIGITALOCEAN_TOKEN , DO_API_TOKEN , DO_API_KEY , DO_OAUTH_TOKEN and OAUTH_TOKEN |
- name: Create DigitalOcean volume
digitalocean.cloud.volume:
token: "{{ token }}"
state: present
name: test-vol-delete-1
region: nyc3
size_gigabytes: 1
- name: Delete DigitalOcean volume
digitalocean.cloud.volume:
token: "{{ token }}"
state: absent
name: test-vol-delete-1
region: nyc3
Key | Returned | Description |
---|---|---|
error (dict) |
failure |
DigitalOcean API error.
Sample:
|
msg (str) |
always |
DigitalOcean volume information.
Sample:
|
volume (dict) |
always |
DigitalOcean volume information.
Sample:
|