Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.gce_snapshot
.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
credentials_file string / required | The path to the credentials file associated with the service account | |
disks string | Default: "all" | A list of disks to create snapshots for. If none is provided, all of the volumes will be snapshotted |
instance_name string / required | The GCE instance to snapshot | |
project_id string / required | The GCP project ID to use | |
service_account_email string / required | GCP service account email for the project where the instance resides | |
snapshot_name string | The name of the snapshot to manage | |
state string |
| Whether a snapshot should be present or absent
|
- name: Create gce snapshot community.general.gce_snapshot: instance_name: example-instance snapshot_name: example-snapshot state: present service_account_email: [email protected] 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: [email protected] 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: [email protected] credentials_file: /path/to/credentials project_id: project_name delegate_to: localhost
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
snapshots_absent list / elements=string | When snapshots were already absent | List of snapshots that were already absent (no-op) Sample: [disk0-example-snapshot, disk1-example-snapshot] |
snapshots_created list / elements=string | When snapshots are created | List of newly created snapshots Sample: [disk0-example-snapshot, disk1-example-snapshot] |
snapshots_deleted list / elements=string | When snapshots are deleted | List of destroyed snapshots Sample: [disk0-example-snapshot, disk1-example-snapshot] |
snapshots_existing list / elements=string | When snapshots were already present | List of snapshots that already existed (no-op) Sample: [disk0-example-snapshot, disk1-example-snapshot] |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/gce_snapshot_module.html