Example Ansible Playbooks

This section describes the sequence of events in the playbooks to create and delete volumes. The playbooks fully automate the volume provisioning process.

Create/Delete Volume

Create Volume Replicated

The create_volume_replicated playbook provisions a resilient volume by executing the following steps:

  1. Create an RBAC authentication token.
  2. Create one volume on the KumoScale device (and the specified number of volume replicas).
  3. Create targets for all specified initiators in the group (if it does not already exist), attaches the volume as a namespace to the target, and organizes access to the target.
  4. Connect all specified initiators to the created targets (creating the corresponding block devices on each of the initiators ).
  5. Configure the RAID (bitmap parameter is equal to internal or not specified) or Cluster MD (bitmap parameter is equal to clustered) on the created block devices of all initiators .
  6. Create the specified file system on each initiator.
  7. Mount the created file systems

Each step (except for generating a token) is repeated according to the number of replicas defined for the volume(s), i.e., two or three replicas.

Delete Volume Replicated

The delete_volume_replicated playbook deletes a resilient volume configuration, by executing the following steps:

  1. Unmount the file system.
  2. Get the replicas’ KumoScale software URLs from the KumoScale Provisioner service.
  3. Stop the mirror replication.
  4. Validate that there are no orphan md devices. Any detected orphan devices are removed.
  5. Disconnect the volumes from the initiator.
  6. Disconnect the NVMe devices.
  7. Un-publish the volume.
  8. Delete the volume(s) – Frees the allocated space (returned to the storage pool).

 

ansible-fig3Figure 3. Sequence Diagram of Delete Volume Replicated Playbook

Create Volume Simple

The create_volume_simple playbook provisions a non-resilient volume by executing the following steps:

  1. Create a volume via the KumoScale Provisioner service (allocates the volume’s capacity).
  2. Publish the volume and grant the initiator access to the target via the KumoScale Provisioner service.
  3. Connect the application server (initiator) to the target.
  4. Create a file system on the initiator and mount the file system.

The playbook supports provisioning multiple volumes at once. Each step is repeated according to the number of provisioned volumes (1 – N).

 

ansible-fig4Figure 4. Sequence Diagram of Create Volume Simple Playbook


Delete Volume Simple

The delete_volume_simple playbook deletes the configuration of one (or several) non-resilient volume(s) by executing the following steps:

  1. Unmount the file system.
  2. Get KumoScale software URLs from the KumoScale Provisioner service.
  3. Disconnect the NVMe devices.
  4. Remove the namespace (and target if it has no namespaces) via the KumoScale Provisioner service.
  5. Delete the volume – Frees the allocated space.

 

ansible-fig5Figure 5. Sequence Diagram of Delete Volume Simple Playbook


Snapshot Examples

These examples show the playbook sequences to use to create and delete volume snapshots.

Create and Delete a Writeable Snapshot of Replicated Volume

Below is an example of the playbook sequence to create and delete a writable snapshot of replicated volume. The parameter host refers to the intiator.

ansible-playbook -v create_volume_replicated.yml

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=present" --limit host2

ansible-playbook -v create_snapshot_volume.yml -e "vol_name=vol2 host=host2 snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 reservedSpacePercentage=20" -e '{"writable": true}' --limit host2




ansible-playbook -v delete_snapshot_volume.yml -e "vol_name=vol2 host=host2" --limit host1

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=absent" --limit host2

ansible-playbook -v delete_volume_replicated.yml --limit host1

Create and Delete a Writeable Snapshot of Volume Simple

Below is an example of the playbook sequence to create and delete a writable snapshot of simple volume.

ansible-playbook -v create_volume_simple.yml --limit host1

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=present" --limit host1

ansible-playbook -v create_snapshot_volume.yml -e "vol_name=vol2 host=host2 snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 reservedSpacePercentage=20" -e '{"writable": true}' --limit host2

 

An example of the playbook sequence to delete a writable snapshot volume: of simple volume, follows:

ansible-playbook -v delete_snapshot_volume.yml -e "vol_name=vol2 host=host2" --limit host2

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=absent" --limit host1

ansible-playbook -v delete_volume_simple.yml --limit host1

 

Create and Delete a Readable Snapshot of Volume Replicated

Below is an example of the playbook sequence to create and delete a readable snapshot of replicated volume.

ansible-playbook -v create_volume_replicated.yml

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=present" --limit host1

ansible-playbook -v create_snapshot_volume.yml -e "vol_name=vol2 host=host2 snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 reservedSpacePercentage=0" -e '{"writable": false}' --limit host2



ansible-playbook -v delete_snapshot_volume.yml -e "vol_name=vol2 host=host2" --limit host2

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=absent" --limit host1

ansible-playbook -v delete_volume_replicated.yml --limit host1

 

Create and Delete a Readable only Snapshot of Simple Volume

Below is an example of the playbook sequence to create and delete a snapshot of simple volume.

ansible-playbook -v create_volume_simple.yml --limit host1

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=present" --limit host1

ansible-playbook -v create_snapshot_volume.yml -e "vol_name=vol2 host=host2 snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 reservedSpacePercentage=0" -e '{"writable": false}' --limit host2


ansible-playbook -v delete_snapshot_volume.yml -e "vol_name=vol2 host=host2" --limit host2

ansible-playbook -v ks_snapshot.yml -e "snap_uuid=59f285cb-1def-4725-b001-d8a637a213e5 state=absent" --limit host1

ansible-playbook -v delete_volume_simple.yml --limit host1

 

Next: KumoScale v. 3.20 documentation list