ansible / ansible.builtin / v2.9.18 / module / cs_snapshot_policy Manages volume snapshot policies on Apache CloudStack based clouds. | "added in version" 2.2 of ansible.builtin" Authors: René Moser (@resmo) stableinterface | supported by communityansible.builtin.cs_snapshot_policy (v2.9.18) — module
pip
Install with pip install ansible==2.9.18
Create, update and delete volume snapshot policies.
- name: ensure a snapshot policy daily at 1h00 UTC cs_snapshot_policy: volume: ROOT-478 schedule: '00:1' max_snaps: 3 delegate_to: localhost
- name: ensure a snapshot policy daily at 1h00 UTC on the second DATADISK of VM web-01 cs_snapshot_policy: vm: web-01 volume_type: DATADISK device_id: 2 schedule: '00:1' max_snaps: 3 delegate_to: localhost
- name: ensure a snapshot policy hourly at minute 5 UTC cs_snapshot_policy: volume: ROOT-478 schedule: '5' interval_type: hourly max_snaps: 1 delegate_to: localhost
- name: ensure a snapshot policy weekly on Sunday at 05h00, TZ Europe/Zurich cs_snapshot_policy: volume: ROOT-478 schedule: '00:5:1' interval_type: weekly max_snaps: 1 time_zone: 'Europe/Zurich' delegate_to: localhost
- name: ensure a snapshot policy is absent cs_snapshot_policy: volume: ROOT-478 interval_type: hourly state: absent delegate_to: localhost
vm: description: - Name of the instance to select the volume from. - Use I(volume_type) if VM has a DATADISK and ROOT volume. - In case of I(volume_type=DATADISK), additionally use I(device_id) if VM has more than one DATADISK volume. - Either I(volume) or I(vm) is required. type: str version_added: '2.3' version_added_collection: ansible.builtin vpc: description: - Name of the vpc the instance is deployed in. type: str version_added: '2.3' version_added_collection: ansible.builtin state: choices: - present - absent default: present description: - State of the snapshot policy. type: str domain: description: - Domain the volume is related to. type: str volume: description: - Name of the volume. - Either I(volume) or I(vm) is required. type: str account: description: - Account the volume is related to. type: str api_key: description: - API key of the CloudStack API. - If not given, the C(CLOUDSTACK_KEY) env variable is considered. required: true type: str api_url: description: - URL of the CloudStack API e.g. https://cloud.example.com/client/api. - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered. required: true type: str project: description: - Name of the project the volume is related to. type: str schedule: description: - Time the snapshot is scheduled. Required if I(state=present). - 'Format for I(interval_type=HOURLY): C(MM)' - 'Format for I(interval_type=DAILY): C(MM:HH)' - 'Format for I(interval_type=WEEKLY): C(MM:HH:DD (1-7))' - 'Format for I(interval_type=MONTHLY): C(MM:HH:DD (1-28))' type: str device_id: description: - ID of the device on a VM the volume is attached to. - This will only be considered if VM has multiple DATADISK volumes. type: int version_added: '2.3' version_added_collection: ansible.builtin max_snaps: aliases: - max default: 8 description: - Max number of snapshots. type: int time_zone: aliases: - timezone default: UTC description: - Specifies a timezone for this command. type: str api_secret: description: - Secret key of the CloudStack API. - If not set, the C(CLOUDSTACK_SECRET) env variable is considered. required: true type: str api_timeout: default: 10 description: - HTTP timeout in seconds. - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered. type: int volume_type: choices: - DATADISK - ROOT description: - Type of the volume. type: str version_added: '2.3' version_added_collection: ansible.builtin interval_type: aliases: - interval choices: - hourly - daily - weekly - monthly default: daily description: - Interval of the snapshot. type: str api_http_method: choices: - get - post default: get description: - HTTP method used to query the API endpoint. - If not given, the C(CLOUDSTACK_METHOD) env variable is considered. type: str api_verify_ssl_cert: description: - Verify CA authority cert file. - If not given, the C(CLOUDSTACK_VERIFY) env variable is considered. type: str
account: description: Account the volume is related to. returned: success sample: example account type: str domain: description: Domain the volume is related to. returned: success sample: example domain type: str id: description: UUID of the snapshot policy. returned: success sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f type: str interval_type: description: interval type of the snapshot policy. returned: success sample: daily type: str max_snaps: description: maximum number of snapshots retained. returned: success sample: 10 type: int project: description: Name of project the volume is related to. returned: success sample: Production type: str schedule: description: schedule of the snapshot policy. returned: success sample: null type: str time_zone: description: the time zone of the snapshot policy. returned: success sample: Etc/UTC type: str volume: description: the volume of the snapshot policy. returned: success sample: Etc/UTC type: str zone: description: Name of zone the volume is related to. returned: success sample: ch-gva-2 type: str