W3cubDocs

/Ansible 2.11

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.0.0).

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

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.9.0

Parameters

Parameter Choices/Defaults Comments
account
string
Account the volume is related to.
api_http_method
string
    Choices:
  • get
  • post
HTTP method used to query the API endpoint.
If not given, the CLOUDSTACK_METHOD env variable is considered.
api_key
string / required
API key of the CloudStack API.
If not given, the CLOUDSTACK_KEY env variable is considered.
api_secret
string / required
Secret key of the CloudStack API.
If not set, the CLOUDSTACK_SECRET env variable is considered.
api_timeout
integer
Default:
10
HTTP timeout in seconds.
If not given, the CLOUDSTACK_TIMEOUT env variable is considered.
api_url
string / required
URL of the CloudStack API e.g. https://cloud.example.com/client/api.
If not given, the CLOUDSTACK_ENDPOINT env variable is considered.
api_verify_ssl_cert
string
Verify CA authority cert file.
If not given, the CLOUDSTACK_VERIFY env variable is considered.
device_id
integer
ID of the device on a VM the volume is attached to.
This will only be considered if VM has multiple DATADISK volumes.
domain
string
Domain the volume is related to.
interval_type
string
    Choices:
  • hourly
  • daily
  • weekly
  • monthly
Interval of the snapshot.

aliases: interval
max_snaps
integer
Default:
8
Max number of snapshots.

aliases: max
project
string
Name of the project the volume is related to.
schedule
string
Time the snapshot is scheduled. Required if state=present.
Format for interval_type=HOURLY: MM
Format for interval_type=DAILY: MM:HH
Format for interval_type=WEEKLY: MM:HH:DD (1-7)
Format for interval_type=MONTHLY: MM:HH:DD (1-28)
state
string
    Choices:
  • present
  • absent
State of the snapshot policy.
time_zone
string
Default:
"UTC"
Specifies a timezone for this command.

aliases: timezone
vm
string
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.
volume
string
Name of the volume.
Either volume or vm is required.
volume_type
string
    Choices:
  • DATADISK
  • ROOT
Type of the volume.
vpc
string
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 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


Authors

  • René Moser (@resmo)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ngine_io/cloudstack/cs_snapshot_policy_module.html