Home > Storage > PowerMax and VMAX > Storage Admin > Dell PowerMax: Ansible Modules Best Practices > Taking a snapshot with Ansible
The snapshot module is mainly used for snapshot creation on an ad hoc basis. It is also used for linking, unlinking, and terminating snapshots. For details about each of these processes, see the SnapVX white paper.
The Ansible-doc is fully populated with examples of each of the supported actions for the module. This section discloses some of the reasoning behind the implementation and how you can get the most out of these features.
As previously discussed, the PowerMax API is based on the concept of a storage group. Therefore, snapshots are taken at the storage group level, creating a consistent point in time image for all the volumes snapped together using SnapVX.
A sample playbook to take an on-demand snapshot is here. The playbook is simple, with only three tasks, as highlighted in Figure 32.
If the link storage group does not already exist or is not already in a masking view, you have to add tasks or run a playbook to mask this storage group to the host or hosts to enable volume access to the applications. See Creating a masking view.
Note: This example uses the snapshot identifier to uniquely identify the snapshot being linked. If your array microcode is lower than 5978.711.711, use the generation number. Also note that single quotes are used in the playbook syntax for setting the snap_id as a fact to ensure that the type remains int; using double quotes implies a string.
Best Practice: When the generation number is used with Ansible, creating snapshots with a unique snapshot name each time makes it easier to identify which generation to use. Generation numbers decrement as newer snapshots are taken using the same snapshot name, making idempotency in playbooks a challenge.
Using the snap id is generally recommended because it makes managing snapshots much simpler. Setting a time to live (ttl) reduces operational maintenance on snapshots to ensure snapshots automatically terminate once the expiration time has passed. Setting a ttl has the added advantage of managing storage capacity better.