ansible.builtin.cloudscale_volume (v2.9.13) — module

Manages volumes on the cloudscale.ch IaaS service.

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

Authors: Gaudenz Steinlin (@gaudenz), René Moser (@resmo)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.13

Description

Create, attach/detach, update and delete volumes on the cloudscale.ch IaaS service.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a new SSD volume
- name: Create an SSD volume
  cloudscale_volume:
    name: my_ssd_volume
    size_gb: 50
    api_token: xxxxxx
  register: my_ssd_volume
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Attach an existing volume to a server
- name: Attach volume to server
  cloudscale_volume:
    uuid: my_ssd_volume.uuid
    server_uuids:
      - ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create and attach a volume to a server
- name: Create and attach volume to server
  cloudscale_volume:
    name: my_ssd_volume
    size_gb: 50
    server_uuids:
      - ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Detach volume from server
- name: Detach volume from server
  cloudscale_volume:
    uuid: my_ssd_volume.uuid
    server_uuids: []
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete a volume
- name: Delete volume
  cloudscale_volume:
    name: my_ssd_volume
    state: absent
    api_token: xxxxxx

Inputs

    
name:
    description:
    - Name of the volume. Either name or UUID must be present to change an existing volume.
    type: str

tags:
    description:
    - Tags associated with the volume. Set this to C({}) to clear any tags.
    type: dict
    version_added: '2.9'
    version_added_collection: ansible.builtin

type:
    choices:
    - ssd
    - bulk
    description:
    - Type of the volume. Cannot be changed after creating the volume. Defaults to C(ssd)
      on volume creation.
    type: str

uuid:
    description:
    - UUID of the volume. Either name or UUID must be present to change an existing volume.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the volume.
    type: str

api_url:
    default: https://api.cloudscale.ch/v1
    description:
    - cloudscale.ch API URL.
    - This can also be passed in the C(CLOUDSCALE_API_URL) environment variable.
    type: str
    version_added: 1.3.0
    version_added_collection: cloudscale_ch.cloud

size_gb:
    description:
    - Size of the volume in GB.
    type: int

api_token:
    description:
    - cloudscale.ch API token.
    - This can also be passed in the C(CLOUDSCALE_API_TOKEN) environment variable.
    required: true
    type: str

api_timeout:
    default: 45
    description:
    - Timeout in seconds for calls to the cloudscale.ch API.
    - This can also be passed in the C(CLOUDSCALE_API_TIMEOUT) environment variable.
    type: int

server_uuids:
    aliases:
    - server_uuid
    description:
    - UUIDs of the servers this volume is attached to. Set this to C([]) to detach the
      volume. Currently a volume can only be attached to a single server.
    type: list

Outputs

href:
  description: The API URL to get details about this volume.
  returned: state == present
  sample: https://api.cloudscale.ch/v1/volumes/2db69ba3-1864-4608-853a-0771b6885a3a
  type: str
name:
  description: The display name of the volume.
  returned: state == present
  sample: my_ssd_volume
  type: str
server_uuids:
  description: The UUIDs of the servers this volume is attached to.
  returned: state == present
  sample:
  - 47cec963-fcd2-482f-bdb6-24461b2d47b1
  type: list
size_gb:
  description: The size of the volume in GB.
  returned: state == present
  sample: 50
  type: str
state:
  description: The current status of the volume.
  returned: success
  sample: present
  type: str
tags:
  description: Tags associated with the volume.
  returned: state == present
  sample:
    project: my project
  type: dict
  version_added: '2.9'
  version_added_collection: ansible.builtin
type:
  description: The type of the volume.
  returned: state == present
  sample: bulk
  type: str
uuid:
  description: The unique identifier for this volume.
  returned: state == present
  sample: 2db69ba3-1864-4608-853a-0771b6885a3a
  type: str