cloudscale_ch.cloud.volume_snapshot module – Manage volume snapshots on the cloudscale.ch IaaS service
Note
This module is part of the cloudscale_ch.cloud collection (version 2.5.2).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install cloudscale_ch.cloud.
To use it in a playbook, specify: cloudscale_ch.cloud.volume_snapshot.
New in cloudscale_ch.cloud 2.5.0
Synopsis
- Get, create, update, delete volume snapshots on the cloudscale.ch IaaS service. 
Parameters
| Parameter | Comments | 
|---|---|
| Timeout in seconds for calls to the cloudscale.ch API. This can also be passed in the  Default:  | |
| cloudscale.ch API token. This can also be passed in the  | |
| cloudscale.ch API URL. This can also be passed in the  Default:  | |
| Name of the volume snapshot. Either name or uuid are required. | |
| UUID of the volume this snapshot belongs to. If name and source_volume are present, a new volume snapshot is created. This parameter has no effect on existing volume snapshots (uuid option is present). | |
| State of the volume snapshot. Choices: 
 | |
| Tags assigned to the volume snapshot. Set this to  | |
| UUID of the volume snapshot. | 
Notes
Note
- If uuid option is provided, it takes precedence over name for volume snapshot selection. This allows to update the volume snapshot’s name. 
- If no uuid option is provided, name is used for volume snapshot selection. If more than one volume snapshot with this name exists, execution is aborted. 
- To revert a snapshot use the volume module. 
- All operations are performed using the cloudscale.ch public API v1. 
- For details consult the full API documentation: https://www.cloudscale.ch/en/api/v1. 
- A valid API token is required for all operations. You can create as many tokens as you like using the cloudscale.ch control panel at https://control.cloudscale.ch. 
Examples
# Create a volume snapshot for a volume
- name: Create a volume snapshot
  cloudscale_ch.cloud.volume_snapshot:
    name: 'pre-dist-upgrade'
    source_volume: '2db69ba3-1864-4608-853a-0771b6885a3a'
    tags: {}
    api_token: xxxxx
# Get a volume snapshot by name
- name: Get facts of a volume snapshot
  cloudscale_ch.cloud.volume_snapshot:
    name: 'pre-dist-upgrade'
    api_token: xxxxx
# Delete a volume snapshot
- name: Delete a volume snapshot
  cloudscale_ch.cloud.volume_snapshot:
    uuid: '351d461c-2333-455f-b788-db11bf0b4aa2'
    state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| The creation date and time of the resource. Returned: state == present Sample:  | |
| The API URL to get details about this volume snapshot. Returned: state == present Sample:  | |
| The display name of the volume snapshot. Returned: state == present Sample:  | |
| The size of the volume in GB. Returned: state == present Sample:  | |
| The source volume this volume snapshot belongs to. Returned: state == present Sample:  | |
| The current status of the volume. Returned: success Sample:  | |
| The current status of the volume snapshot. Returned: success Sample:  | |
| Tags associated with the volume. Returned: state == present Sample:  | |
| The unique identifier for this volume snapshot. Returned: state == present Sample:  | 
