volume
Manages volumes on the cloudscale.ch IaaS service
Collection: cloudscale_ch.cloud
Full Name: cloudscale_ch.cloud.volume
Synopsis
Manages volumes on the cloudscale.ch IaaS service
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| api_url | str | Cloudscale API URL; defaults from CLOUDSCALE_API_URL or https://api.cloudscale.ch/v1. | ||
| api_token | str | API bearer token; defaults from CLOUDSCALE_API_TOKEN. | ||
| api_timeout | int | Request timeout seconds; defaults from CLOUDSCALE_API_TIMEOUT or 45. | ||
| name | str | Name of the volume. Either name or UUID must be present to change an existing volume. | ||
| revert | str | UUID of the snapshot to revert the volume to. This must be the most recent snapshot of the volume. For root volumes: the respective server must be shut down. For non-root volumes: the volume to be reverted must be detached | ||
| servers | list | 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. | ||
| size_gb | int | Size of the volume in GB. | ||
| state | str | present | State of the volume. | |
| tags | dict | Tags associated with the volume. Set this to C({}) to clear any tags. | ||
| type | str | Type of the volume. Cannot be changed after creating the volume. Defaults to C(ssd) on volume creation. | ||
| uuid | str | UUID of the volume. Either name or UUID must be present to change an existing volume. | ||
| zone | str | 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. |
Example
yaml
# 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
# 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
# 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
# Detach volume from server
- name: Detach volume from server
cloudscale_ch.cloud.volume:
uuid: "{{ my_ssd_volume.uuid }}"
servers: []
api_token: xxxxxx
# Revert a volume to the most recent snapshot
- name: Revert volume to snapshot
cloudscale_ch.cloud.volume:
uuid: "{{ my_ssd_volume.uuid }}"
revert: "e504dc99-ff01-4e89-ad89-7df080f97b4b"
api_token: xxxxxx
# Delete a volume
- name: Delete volume
cloudscale_ch.cloud.volume:
name: my_ssd_volume
state: absent
api_token: xxxxxx