Often we will need to create snapshots of instances. These can be used as backup or to create more instances to scale up . Typically, a daily or weekly cron of the Ansible task would help in maintaining a periodic backup.
Creating snapshots for backup
How to do it...
We can use the gce_snapshot module to create a snapshot:
- name: create snapshot of instance
gce_snapshot:
instance_name: app
snapshot_name: app-snapshot
state: present
service_account_email: "{{ service_account_email }}"
project_id: "{{ project_id }}"
credentials_file: "{{ credentials_file }}"
tags:
- recipe4