New in version 2.1.
parameter | required | default | choices | comments |
---|---|---|---|---|
account | no | Account the volume is related to. | ||
api_http_method | no | get |
| HTTP method used. |
api_key | no | API key of the CloudStack API. | ||
api_region | no | cloudstack | Name of the ini section in the cloustack.ini file. | |
api_secret | no | Secret key of the CloudStack API. | ||
api_timeout | no | 10 | HTTP timeout. | |
api_url | no | URL of the CloudStack API e.g. https://cloud.example.com/client/api. | ||
custom_id | no | Custom id to the resource. Allowed to Root Admins only. | ||
disk_offering | no | Name of the disk offering to be used. Required one of disk_offering , snapshot if volume is not already state=present . | ||
display_volume | no | True | Whether to display the volume to the end user or not. Allowed to Root Admins only. | |
domain | no | Name of the domain the volume to be deployed in. | ||
force | no | Force removal of volume even it is attached to a VM. Considered on state=absnet only. | ||
max_iops | no | Max iops | ||
min_iops | no | Min iops | ||
name | yes | Name of the volume. name can only contain ASCII letters. | ||
poll_async | no | True | Poll async jobs until job has finished. | |
project | no | Name of the project the volume to be deployed in. | ||
shrink_ok | no | Whether to allow to shrink the volume. | ||
size | no | Size of disk in GB | ||
snapshot | no | The snapshot name for the disk volume. Required one of disk_offering , snapshot if volume is not already state=present . | ||
state | no | present |
| State of the volume. |
tags (added in 2.4)
| no | List of tags. Tags are a list of dictionaries having keys key and value .To delete all tags, set a empty list e.g. tags: [] .aliases: tag | ||
vm | no | Name of the virtual machine to attach the volume to. | ||
zone | no | Name of the zone in which the volume should be deployed. If not set, default zone is used. |
# Create volume within project, zone with specified storage options - local_action: module: cs_volume name: web-vm-1-volume project: Integration zone: ch-zrh-ix-01 disk_offering: PerfPlus Storage size: 20 # Create/attach volume to instance - local_action: module: cs_volume name: web-vm-1-volume disk_offering: PerfPlus Storage size: 20 vm: web-vm-1 state: attached # Detach volume - local_action: module: cs_volume name: web-vm-1-volume state: detached # Remove volume - local_action: module: cs_volume name: web-vm-1-volume state: absent
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
domain | Domain the volume belongs to | success | string | example domain |
group | Group the volume belongs to | success | string | web |
name | Name of the volume. | success | string | web-volume-01 |
zone | Name of zone the volume is in. | success | string | ch-gva-2 |
created | Date of the volume was created. | success | string | 2014-12-01T14:57:57+0100 |
attached | Date of the volume was attached. | success | string | 2014-12-01T14:57:57+0100 |
vm | Name of the vm the volume is attached to (not returned when detached) | success | string | web-01 |
project | Project the volume belongs to | success | string | Production |
state | State of the volume | success | string | Attached |
display_name | Display name of the volume. | success | string | web-volume-01 |
size | Size of disk volume. | success | string | 20 |
type | Disk volume type. | success | string | DATADISK |
id | ID of the volume. | success | string | None |
device_id | Id of the device on user vm the volume is attached to (not returned when detached) | success | string | 1 |
Note
cs
library’s configuration method if credentials are not provided by the arguments api_url
, api_key
, api_secret
. Configuration is read from several locations, in the following order. - The CLOUDSTACK_ENDPOINT
, CLOUDSTACK_KEY
, CLOUDSTACK_SECRET
and CLOUDSTACK_METHOD
. CLOUDSTACK_TIMEOUT
environment variables. - A CLOUDSTACK_CONFIG
environment variable pointing to an .ini
file, - A cloudstack.ini
file in the current working directory. - A .cloudstack.ini
file in the users home directory. Optionally multiple credentials and endpoints can be specified using ini sections in cloudstack.ini
. Use the argument api_region
to select the section name, default section is cloudstack
. See https://github.com/exoscale/cs for more information.This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/cs_volume_module.html