community / community.general / 1.3.14 / module / gce_snapshot Create or destroy snapshots for GCE storage volumes Authors: Rob Wagner (@robwagner33)community.general.gce_snapshot (1.3.14) — module
Install with ansible-galaxy collection install community.general:==1.3.14
collections: - name: community.general version: 1.3.14
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 community.general.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 community.general.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 community.general.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: description: - A list of disks to create snapshots for. If none is provided, all of the volumes will have snapshots created. required: false type: list state: choices: - present - absent default: present description: - Whether a snapshot should be C(present) or C(absent) required: false type: str project_id: description: - The GCP project ID to use type: str instance_name: description: - The GCE instance to snapshot required: true type: str snapshot_name: description: - The name of the snapshot to manage required: true type: str credentials_file: description: - The path to the credentials file associated with the service account type: path service_account_email: description: - GCP service account email for the project where the instance resides type: str
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