community / community.general / 0.2.1 / module / gce_snapshot Create or destroy snapshots for GCE storage volumes Authors: Rob Wagner (@robwagner33)community.general.gce_snapshot (0.2.1) — module
Install with ansible-galaxy collection install community.general:==0.2.1
collections: - name: community.general version: 0.2.1
Manages snapshots for GCE instances. This module manages snapshots for the storage volumes of a GCE compute instance. If there are multiple volumes, each snapshot will be prepended with the disk name
- name: Create gce snapshot gce_snapshot: instance_name: example-instance snapshot_name: example-snapshot state: present service_account_email: project_name@appspot.gserviceaccount.com credentials_file: /path/to/credentials project_id: project_name delegate_to: localhost
- name: Delete gce snapshot gce_snapshot: instance_name: example-instance snapshot_name: example-snapshot state: absent service_account_email: project_name@appspot.gserviceaccount.com credentials_file: /path/to/credentials project_id: project_name delegate_to: localhost
# This example creates snapshots for only two of the available disks as # disk0-example-snapshot and disk1-example-snapshot - name: Create snapshots of specific disks gce_snapshot: instance_name: example-instance snapshot_name: example-snapshot state: present disks: - disk0 - disk1 service_account_email: project_name@appspot.gserviceaccount.com credentials_file: /path/to/credentials project_id: project_name delegate_to: localhost
disks: default: all description: - A list of disks to create snapshots for. If none is provided, all of the volumes will be snapshotted required: false state: choices: - present - absent default: present description: - Whether a snapshot should be C(present) or C(absent) required: false project_id: description: - The GCP project ID to use required: true instance_name: description: - The GCE instance to snapshot required: true snapshot_name: description: - The name of the snapshot to manage credentials_file: description: - The path to the credentials file associated with the service account required: true service_account_email: description: - GCP service account email for the project where the instance resides required: true
snapshots_absent: description: List of snapshots that were already absent (no-op) returned: When snapshots were already absent sample: '[disk0-example-snapshot, disk1-example-snapshot]' type: list snapshots_created: description: List of newly created snapshots returned: When snapshots are created sample: '[disk0-example-snapshot, disk1-example-snapshot]' type: list snapshots_deleted: description: List of destroyed snapshots returned: When snapshots are deleted sample: '[disk0-example-snapshot, disk1-example-snapshot]' type: list snapshots_existing: description: List of snapshots that already existed (no-op) returned: When snapshots were already present sample: '[disk0-example-snapshot, disk1-example-snapshot]' type: list