community / community.general / 0.1.1 / module / cs_volume Manages volumes on Apache CloudStack based clouds. Authors: Jefferson Girão (@jeffersongirao), René Moser (@resmo) stableinterface | supported by communitycommunity.general.cs_volume (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
Create, destroy, attach, detach, extract or upload volumes.
- name: create volume within project and zone with specified storage options cs_volume: name: web-vm-1-volume project: Integration zone: ch-zrh-ix-01 disk_offering: PerfPlus Storage size: 20 delegate_to: localhost
- name: create/attach volume to instance cs_volume: name: web-vm-1-volume disk_offering: PerfPlus Storage size: 20 vm: web-vm-1 state: attached delegate_to: localhost
- name: detach volume cs_volume: name: web-vm-1-volume state: detached delegate_to: localhost
- name: remove volume cs_volume: name: web-vm-1-volume state: absent delegate_to: localhost
# New in version 2.8 - name: Extract DATA volume to make it downloadable cs_volume: state: extracted name: web-vm-1-volume register: data_vol_out delegate_to: localhost
- name: Create new volume by downloading source volume cs_volume: state: uploaded name: web-vm-1-volume-2 format: VHD url: "{{ data_vol_out.url }}" delegate_to: localhost
vm: description: - Name of the virtual machine to attach the volume to. type: str url: description: - URL to which the volume would be extracted on I(state=extracted) - or the URL where to download the volume on I(state=uploaded). - Only considered if I(state) is C(extracted) or C(uploaded). type: str mode: choices: - http_download - ftp_upload default: http_download description: - Mode for the volume extraction. - Only considered if I(state=extracted). type: str name: description: - Name of the volume. - I(name) can only contain ASCII letters. required: true type: str size: description: - Size of disk in GB type: int tags: aliases: - tag description: - List of tags. Tags are a list of dictionaries having keys I(key) and I(value). - 'To delete all tags, set a empty list e.g. I(tags: []).' type: list zone: description: - Name of the zone in which the volume should be deployed. - If not set, default zone is used. type: str force: default: false description: - Force removal of volume even it is attached to a VM. - Considered on I(state=absent) only. type: bool state: choices: - present - absent - attached - detached - extracted - uploaded default: present description: - State of the volume. - The choices C(extracted) and C(uploaded) were added in version 2.8. type: str domain: description: - Name of the domain the volume to be deployed in. type: str format: choices: - QCOW2 - RAW - VHD - VHDX - OVA description: - The format for the volume. - Only considered if I(state=uploaded). type: str account: description: - Account the volume is related to. type: str api_key: description: - API key of the CloudStack API. - If not given, the C(CLOUDSTACK_KEY) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. type: str api_url: description: - URL of the CloudStack API e.g. https://cloud.example.com/client/api. - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. type: str project: description: - Name of the project the volume to be deployed in. type: str max_iops: description: - Max iops type: int min_iops: description: - Min iops type: int snapshot: description: - The snapshot name for the disk volume. - Required one of I(disk_offering), I(snapshot) if volume is not already I(state=present). type: str custom_id: description: - Custom id to the resource. - Allowed to Root Admins only. type: str device_id: description: - ID of the device on a VM the volume is attached to. - Only considered if I(state) is C(attached). type: int shrink_ok: default: false description: - Whether to allow to shrink the volume. type: bool api_region: default: cloudstack description: - Name of the ini section in the C(cloustack.ini) file. - If not given, the C(CLOUDSTACK_REGION) env variable is considered. type: str api_secret: description: - Secret key of the CloudStack API. - If not set, the C(CLOUDSTACK_SECRET) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. type: str poll_async: default: true description: - Poll async jobs until job has finished. type: bool api_timeout: description: - HTTP timeout in seconds. - If not given, the C(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. type: int disk_offering: description: - Name of the disk offering to be used. - Required one of I(disk_offering), I(snapshot) if volume is not already I(state=present). type: str display_volume: description: - Whether to display the volume to the end user or not. - Allowed to Root Admins only. type: bool api_http_method: choices: - get - post description: - HTTP method used to query the API endpoint. - If not given, the C(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 C(get) if not specified. type: str
attached: description: Date of the volume was attached. returned: success sample: 2014-12-01T14:57:57+0100 type: str created: description: Date of the volume was created. returned: success sample: 2014-12-01T14:57:57+0100 type: str device_id: description: Id of the device on user vm the volume is attached to (not returned when detached) returned: success sample: 1 type: int display_name: description: Display name of the volume. returned: success sample: web-volume-01 type: str domain: description: Domain the volume belongs to returned: success sample: example domain type: str group: description: Group the volume belongs to returned: success sample: web type: str id: description: ID of the volume. returned: success sample: null type: str name: description: Name of the volume. returned: success sample: web-volume-01 type: str project: description: Project the volume belongs to returned: success sample: Production type: str size: description: Size of disk volume. returned: success sample: 20 type: int state: description: State of the volume returned: success sample: Attached type: str type: description: Disk volume type. returned: success sample: DATADISK type: str url: description: The url of the uploaded volume or the download url depending extraction mode. returned: success when I(state=extracted) sample: http://1.12.3.4/userdata/387e2c7c-7c42-4ecc-b4ed-84e8367a1965.vhd type: str version_added: '2.8' version_added_collection: community.general vm: description: Name of the vm the volume is attached to (not returned when detached) returned: success sample: web-01 type: str zone: description: Name of zone the volume is in. returned: success sample: ch-gva-2 type: str