cloudscale_ch.cloud.volume (2.3.1) — module

Manages volumes on the cloudscale.ch IaaS service.

| "added in version" 1.0.0 of cloudscale_ch.cloud"

Authors: Gaudenz Steinlin (@gaudenz), René Moser (@resmo), Denis Krienbühl (@href)

Install collection

Install with ansible-galaxy collection install cloudscale_ch.cloud:==2.3.1


Add to requirements.yml

  collections:
    - name: cloudscale_ch.cloud
      version: 2.3.1

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_ch.cloud.volume:
    name: my_ssd_volume
    zone: 'lpg1'
    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_ch.cloud.volume:
    uuid: "{{ my_ssd_volume.uuid }}"
    servers:
      - 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_ch.cloud.volume:
    name: my_ssd_volume
    zone: 'lpg1'
    size_gb: 50
    servers:
      - 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_ch.cloud.volume:
    uuid: "{{ my_ssd_volume.uuid }}"
    servers: []
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete a volume
- name: Delete volume
  cloudscale_ch.cloud.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

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

zone:
    description:
    - Zone in which the volume resides (e.g. C(lpg1) or C(rma1)). Cannot be changed after
      creating the volume. Defaults to the project default zone.
    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

servers:
    aliases:
    - server_uuids
    - 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.
    - The aliases C(server_uuids) and C(server_uuid) are deprecated and will be removed
      in version 3.0.0 of this collection.
    elements: str
    type: list

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

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. This return value
    is deprecated and will disappear in the future when the field is removed from
    the API.
  returned: state == present
  sample:
  - 47cec963-fcd2-482f-bdb6-24461b2d47b1
  type: list
servers:
  description: The list of servers this volume is attached to.
  returned: state == present
  sample:
  - href: https://api.cloudscale.ch/v1/servers/47cec963-fcd2-482f-bdb6-24461b2d47b1
    name: my_server
    uuid: 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
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
zone:
  description: The zone of the volume.
  returned: state == present
  sample:
    slug: lpg1
  type: dict