ngine_io.cloudstack.cs_snapshot_policy – Manages volume snapshot policies on Apache CloudStack based clouds.
Note
This plugin is part of the ngine_io.cloudstack collection (version 2.2.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 ngine_io.cloudstack
.
To use it in a playbook, specify: ngine_io.cloudstack.cs_snapshot_policy
.
New in version 0.1.0: of ngine_io.cloudstack
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.6
cs >= 0.9.0
Parameters
Parameter |
Comments |
---|---|
Account the volume is related to. |
|
HTTP method used to query the API endpoint. If not given, the Choices:
|
|
API key of the CloudStack API. If not given, the |
|
Secret key of the CloudStack API. If not set, the |
|
HTTP timeout in seconds. If not given, the Default: 10 |
|
URL of the CloudStack API e.g. https://cloud.example.com/client/api. If not given, the |
|
Verify CA authority cert file. If not given, the |
|
ID of the device on a VM the volume is attached to. This will only be considered if VM has multiple DATADISK volumes. |
|
Domain the volume is related to. |
|
Interval of the snapshot. Choices:
|
|
Max number of snapshots. Default: 8 |
|
Name of the project the volume is related to. |
|
Time the snapshot is scheduled. Required if state=present. Format for interval_type=HOURLY: Format for interval_type=DAILY: Format for interval_type=WEEKLY: Format for interval_type=MONTHLY: |
|
State of the snapshot policy. Choices:
|
|
Specifies a timezone for this command. Default: “UTC” |
|
Name of the instance to select the volume from. Use volume_type if VM has a DATADISK and ROOT volume. In case of volume_type=DATADISK, additionally use device_id if VM has more than one DATADISK volume. Either volume or vm is required. |
|
Name of the volume. Either volume or vm is required. |
|
Type of the volume. Choices:
|
|
Name of the vpc the instance is deployed in. |
Notes
Note
A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
This module supports check mode.
Examples
- name: ensure a snapshot policy daily at 1h00 UTC
ngine_io.cloudstack.cs_snapshot_policy:
volume: ROOT-478
schedule: '00:1'
max_snaps: 3
- name: ensure a snapshot policy daily at 1h00 UTC on the second DATADISK of VM web-01
ngine_io.cloudstack.cs_snapshot_policy:
vm: web-01
volume_type: DATADISK
device_id: 2
schedule: '00:1'
max_snaps: 3
- name: ensure a snapshot policy hourly at minute 5 UTC
ngine_io.cloudstack.cs_snapshot_policy:
volume: ROOT-478
schedule: '5'
interval_type: hourly
max_snaps: 1
- name: ensure a snapshot policy weekly on Sunday at 05h00, TZ Europe/Zurich
ngine_io.cloudstack.cs_snapshot_policy:
volume: ROOT-478
schedule: '00:5:1'
interval_type: weekly
max_snaps: 1
time_zone: 'Europe/Zurich'
- name: ensure a snapshot policy is absent
ngine_io.cloudstack.cs_snapshot_policy:
volume: ROOT-478
interval_type: hourly
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Account the volume is related to. Returned: success Sample: “example account” |
|
Domain the volume is related to. Returned: success Sample: “example domain” |
|
UUID of the snapshot policy. Returned: success Sample: “a6f7a5fc-43f8-11e5-a151-feff819cdc9f” |
|
interval type of the snapshot policy. Returned: success Sample: “daily” |
|
maximum number of snapshots retained. Returned: success Sample: 10 |
|
Name of project the volume is related to. Returned: success Sample: “Production” |
|
schedule of the snapshot policy. Returned: success |
|
the time zone of the snapshot policy. Returned: success Sample: “Etc/UTC” |
|
the volume of the snapshot policy. Returned: success Sample: “Etc/UTC” |
|
Name of zone the volume is related to. Returned: success Sample: “ch-gva-2” |
Authors
René Moser (@resmo)