community.general.cloudscale_volume (0.1.4) — module

Manages volumes on the cloudscale.ch IaaS service.

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

Install collection

Install with ansible-galaxy collection install community.general:==0.1.4


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.4

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
    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_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
    zone: 'lpg1'
    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

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(lgp1) or C(rma1)). Cannot be changed after
      creating the volume. Defaults to the project default zone.
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

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

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.
    type: str

api_timeout:
    default: 30
    description:
    - Timeout in seconds for calls to the cloudscale.ch API.
    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
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
  version_added: 0.2.0
  version_added_collection: community.general