ansible.builtin.cs_volume (v2.5.11) — module

Manages volumes on Apache CloudStack based clouds.

| "added in version" 2.1 of ansible.builtin"

Authors: Jefferson Girão (@jeffersongirao), René Moser (@resmo)

stableinterface | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.11

Description

Create, destroy, attach, detach volumes.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create volume within project and 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: detach volume
  local_action:
    module: cs_volume
    name: web-vm-1-volume
    state: detached
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove volume
  local_action:
    module: cs_volume
    name: web-vm-1-volume
    state: absent

Inputs

    
vm:
    description:
    - Name of the virtual machine to attach the volume to.

name:
    description:
    - Name of the volume.
    - C(name) can only contain ASCII letters.
    required: true

size:
    description:
    - Size of disk in GB

tags:
    aliases:
    - tag
    description:
    - List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
    - 'To delete all tags, set a empty list e.g. C(tags: []).'
    version_added: '2.4'
    version_added_collection: ansible.builtin

zone:
    description:
    - Name of the zone in which the volume should be deployed.
    - If not set, default zone is used.

force:
    default: false
    description:
    - Force removal of volume even it is attached to a VM.
    - Considered on C(state=absnet) only.

state:
    choices:
    - present
    - absent
    - attached
    - detached
    default: present
    description:
    - State of the volume.

domain:
    description:
    - Name of the domain the volume to be deployed in.

account:
    description:
    - Account the volume is related to.

api_key:
    description:
    - API key of the CloudStack API.
    - If not given, the C(CLOUDSTACK_KEY) env variable is considered.
    required: true
    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.
    required: true
    type: str

project:
    description:
    - Name of the project the volume to be deployed in.

max_iops:
    description:
    - Max iops

min_iops:
    description:
    - Min iops

snapshot:
    description:
    - The snapshot name for the disk volume.
    - Required one of C(disk_offering), C(snapshot) if volume is not already C(state=present).

custom_id:
    description:
    - Custom id to the resource.
    - Allowed to Root Admins only.

shrink_ok:
    default: false
    description:
    - Whether to allow to shrink the volume.

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    required: true
    type: str

poll_async:
    default: true
    description:
    - Poll async jobs until job has finished.

api_timeout:
    default: 10
    description:
    - HTTP timeout in seconds.
    - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered.
    type: int

disk_offering:
    description:
    - Name of the disk offering to be used.
    - Required one of C(disk_offering), C(snapshot) if volume is not already C(state=present).

display_volume:
    default: true
    description:
    - Whether to display the volume to the end user or not.
    - Allowed to Root Admins only.

api_http_method:
    choices:
    - get
    - post
    default: get
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(CLOUDSTACK_METHOD) env variable is considered.
    type: str

api_verify_ssl_cert:
    description:
    - Verify CA authority cert file.
    - If not given, the C(CLOUDSTACK_VERIFY) env variable is considered.
    type: str

Outputs

attached:
  description: Date of the volume was attached.
  returned: success
  sample: 2014-12-01T14:57:57+0100
  type: string
created:
  description: Date of the volume was created.
  returned: success
  sample: 2014-12-01T14:57:57+0100
  type: string
device_id:
  description: Id of the device on user vm the volume is attached to (not returned
    when detached)
  returned: success
  sample: 1
  type: string
display_name:
  description: Display name of the volume.
  returned: success
  sample: web-volume-01
  type: string
domain:
  description: Domain the volume belongs to
  returned: success
  sample: example domain
  type: string
group:
  description: Group the volume belongs to
  returned: success
  sample: web
  type: string
id:
  description: ID of the volume.
  returned: success
  sample: null
  type: string
name:
  description: Name of the volume.
  returned: success
  sample: web-volume-01
  type: string
project:
  description: Project the volume belongs to
  returned: success
  sample: Production
  type: string
size:
  description: Size of disk volume.
  returned: success
  sample: 20
  type: string
state:
  description: State of the volume
  returned: success
  sample: Attached
  type: string
type:
  description: Disk volume type.
  returned: success
  sample: DATADISK
  type: string
vm:
  description: Name of the vm the volume is attached to (not returned when detached)
  returned: success
  sample: web-01
  type: string
zone:
  description: Name of zone the volume is in.
  returned: success
  sample: ch-gva-2
  type: string