gce_snapshot - Create or destroy snapshots for GCE storage volumes
New in version 2.3.
Synopsis
- 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
Requirements (on host that executes module)
- python >= 2.6
- apache-libcloud >= 0.19.0
Options
parameter | required | default | choices | comments |
---|---|---|---|---|
credentials_file | yes | The path to the credentials file associated with the service account | ||
disks | no | all | A list of disks to create snapshots for. If none is provided, all of the volumes will be snapshotted | |
instance_name | yes | The GCE instance to snapshot | ||
project_id | yes | The GCP project ID to use | ||
service_account_email | yes | GCP service account email for the project where the instance resides | ||
snapshot_name | no | The name of the snapshot to manage | ||
state | no | present |
| Whether a snapshot should be present or absent
|
Examples
- name: Create gce snapshot 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 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 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
Return Values
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
snapshots_absent | List of snapshots that were already absent (no-op) | When snapshots were already absent | list | [disk0-example-snapshot, disk1-example-snapshot] |
snapshots_created | List of newly created snapshots | When snapshots are created | list | [disk0-example-snapshot, disk1-example-snapshot] |
snapshots_deleted | List of destroyed snapshots | When snapshots are deleted | list | [disk0-example-snapshot, disk1-example-snapshot] |
snapshots_existing | List of snapshots that already existed (no-op) | When snapshots were already present | list | [disk0-example-snapshot, disk1-example-snapshot] |
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/gce_snapshot_module.html