Note
This plugin is part of the ngine_io.cloudstack collection.
To install it use: ansible-galaxy collection install ngine_io.cloudstack.
To use it in a playbook, specify: ngine_io.cloudstack.cs_volume.
New in version 0.1.0: of ngine_io.cloudstack
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| account string | Account the volume is related to. | |
| api_http_method string |
| HTTP method used to query the API endpoint. If not given, the CLOUDSTACK_METHOD env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. Fallback value is get if not specified. |
| api_key string | API key of the CloudStack API. If not given, the CLOUDSTACK_KEY env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. | |
| api_region string | Default: "cloudstack" | Name of the ini section in the cloustack.ini file.If not given, the CLOUDSTACK_REGION env variable is considered. |
| api_secret string | Secret key of the CloudStack API. If not set, the CLOUDSTACK_SECRET env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. | |
| api_timeout integer | HTTP timeout in seconds. If not given, the CLOUDSTACK_TIMEOUT env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. Fallback value is 10 seconds if not specified. | |
| api_url string | URL of the CloudStack API e.g. https://cloud.example.com/client/api. If not given, the CLOUDSTACK_ENDPOINT env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. | |
| api_verify_ssl_cert string | CA authority cert file. If not given, the CLOUDSTACK_VERIFY env variable is considered.As the last option, the value is taken from the ini config file, also see the notes. Fallback value is null if not specified. | |
| custom_id string | Custom id to the resource. Allowed to Root Admins only. | |
| device_id integer | ID of the device on a VM the volume is attached to. Only considered if state is attached. | |
| disk_offering string | Name of the disk offering to be used. Required one of disk_offering, snapshot if volume is not already state=present. | |
| display_volume boolean |
| Whether to display the volume to the end user or not. Allowed to Root Admins only. |
| domain string | Name of the domain the volume to be deployed in. | |
| force boolean |
| Force removal of volume even it is attached to a VM. Considered on state=absent only. |
| format string |
| The format for the volume. Only considered if state=uploaded. |
| max_iops integer | Max iops | |
| min_iops integer | Min iops | |
| mode string |
| Mode for the volume extraction. Only considered if state=extracted. |
| name string / required | Name of the volume.
name can only contain ASCII letters. | |
| poll_async boolean |
| Poll async jobs until job has finished. |
| project string | Name of the project the volume to be deployed in. | |
| shrink_ok boolean |
| Whether to allow to shrink the volume. |
| size integer | Size of disk in GB | |
| snapshot string | The snapshot name for the disk volume. Required one of disk_offering, snapshot if volume is not already state=present. | |
| state string |
| State of the volume. |
| tags list / elements=dictionary | 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 | |
| url string | URL to which the volume would be extracted on state=extracted
or the URL where to download the volume on state=uploaded. Only considered if state is extracted or uploaded. | |
| vm string | Name of the virtual machine to attach the volume to. | |
| zone string | Name of the zone in which the volume should be deployed. If not set, default zone is used. |
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.- name: create volume within project and zone with specified storage options
ngine_io.cloudstack.cs_volume:
name: web-vm-1-volume
project: Integration
zone: ch-zrh-ix-01
disk_offering: PerfPlus Storage
size: 20
- name: create/attach volume to instance
ngine_io.cloudstack.cs_volume:
name: web-vm-1-volume
disk_offering: PerfPlus Storage
size: 20
vm: web-vm-1
state: attached
- name: detach volume
ngine_io.cloudstack.cs_volume:
name: web-vm-1-volume
state: detached
- name: remove volume
ngine_io.cloudstack.cs_volume:
name: web-vm-1-volume
state: absent
- name: Extract DATA volume to make it downloadable
ngine_io.cloudstack.cs_volume:
state: extracted
name: web-vm-1-volume
register: data_vol_out
- name: Create new volume by downloading source volume
ngine_io.cloudstack.cs_volume:
state: uploaded
name: web-vm-1-volume-2
format: VHD
url: "{{ data_vol_out.url }}"
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| attached string | success | Date of the volume was attached. Sample: 2014-12-01T14:57:57+0100 |
| created string | success | Date of the volume was created. Sample: 2014-12-01T14:57:57+0100 |
| device_id integer | success | Id of the device on user vm the volume is attached to (not returned when detached) Sample: 1 |
| display_name string | success | Display name of the volume. Sample: web-volume-01 |
| domain string | success | Domain the volume belongs to Sample: example domain |
| group string | success | Group the volume belongs to Sample: web |
| id string | success | ID of the volume. |
| name string | success | Name of the volume. Sample: web-volume-01 |
| project string | success | Project the volume belongs to Sample: Production |
| size integer | success | Size of disk volume. Sample: 20 |
| state string | success | State of the volume Sample: Attached |
| type string | success | Disk volume type. Sample: DATADISK |
| url string | success when state=extracted | The url of the uploaded volume or the download url depending extraction mode. Sample: http://1.12.3.4/userdata/387e2c7c-7c42-4ecc-b4ed-84e8367a1965.vhd |
| vm string | success | Name of the vm the volume is attached to (not returned when detached) Sample: web-01 |
| zone string | success | Name of zone the volume is in. Sample: ch-gva-2 |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ngine_io/cloudstack/cs_volume_module.html