cs_snapshot_policy – Manages volume snapshot policies on Apache CloudStack based clouds.
cs_snapshot_policy – Manages volume snapshot policies on Apache CloudStack based clouds.
New in version 2.2.
Synopsis
- Create, update and delete volume snapshot policies.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.6
- cs >= 0.6.10
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
account - |
Account the volume is related to. | |
api_http_method - |
|
HTTP method used to query the API endpoint. If not given, the As the last option, the value is taken from the ini config file, also see the notes. Fallback value is |
api_key - |
API key of the CloudStack API. If not given, the As the last option, the value is taken from the ini config file, also see the notes. | |
api_region - |
Default: "cloudstack" |
Name of the ini section in the If not given, the |
api_secret - |
Secret key of the CloudStack API. If not set, the As the last option, the value is taken from the ini config file, also see the notes. | |
api_timeout - |
HTTP timeout in seconds. If not given, the As the last option, the value is taken from the ini config file, also see the notes. Fallback value is 10 seconds if not specified. | |
api_url - |
URL of the CloudStack API e.g. https://cloud.example.com/client/api. If not given, the As the last option, the value is taken from the ini config file, also see the notes. | |
device_id - added in 2.3 |
ID of the device on a VM the volume is attached to. This will only be considered if VM has multiple DATADISK volumes. | |
domain - |
Domain the volume is related to. | |
interval_type - |
|
Interval of the snapshot.
|
max_snaps - |
Default: 8 |
Max number of snapshots.
|
project - |
Name of the project the volume is related to. | |
schedule - |
Time the snapshot is scheduled. Required if Format for Format for Format for Format for | |
state - |
|
State of the snapshot policy. |
time_zone - |
Default: "UTC" |
Specifies a timezone for this command.
|
vm - added in 2.3 |
Name of the instance to select the volume from. Use In case of Either | |
volume - |
Name of the volume. Either | |
volume_type - added in 2.3 |
|
Type of the volume. |
vpc - added in 2.3 |
Name of the vpc the instance is deployed in. |
Notes
Note
- Ansible uses the
cs
library’s configuration method if credentials are not provided by the argumentsapi_url
,api_key
,api_secret
. Configuration is read from several locations, in the following order. TheCLOUDSTACK_ENDPOINT
,CLOUDSTACK_KEY
,CLOUDSTACK_SECRET
andCLOUDSTACK_METHOD
.CLOUDSTACK_TIMEOUT
environment variables. ACLOUDSTACK_CONFIG
environment variable pointing to an.ini
file. Acloudstack.ini
file in the current working directory. A.cloudstack.ini
file in the users home directory. Optionally multiple credentials and endpoints can be specified using ini sections incloudstack.ini
. Use the argumentapi_region
to select the section name, default section iscloudstack
. See https://github.com/exoscale/cs for more information. - 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
local_action:
module: 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
local_action:
module: 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
local_action:
module: 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
local_action:
module: 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
local_action:
module: 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 | Returned | Description |
---|---|---|
account string |
success |
Account the volume is related to.
Sample: example account |
domain string |
success |
Domain the volume is related to.
Sample: example domain |
id string |
success |
UUID of the snapshot policy.
Sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f |
interval_type string |
success |
interval type of the snapshot policy.
Sample: daily |
max_snaps integer |
success |
maximum number of snapshots retained.
Sample: 10 |
project string |
success |
Name of project the volume is related to.
Sample: Production |
schedule string |
success |
schedule of the snapshot policy.
|
time_zone string |
success |
the time zone of the snapshot policy.
Sample: Etc/UTC |
volume string |
success |
the volume of the snapshot policy.
Sample: Etc/UTC |
zone string |
success |
Name of zone the volume is related to.
Sample: ch-gva-2 |
Status
- This module is guaranteed to have no backward incompatible interface changes going forward. [stableinterface]
- This module is maintained by the Ansible Community. [community]
Authors
- René Moser (@resmo)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/cs_snapshot_policy_module.html