Role - snapshot_and_revert

Role Documentation

Welcome to the “snapshot_and_revert” role documentation.

Role Defaults

This section highlights all of the defaults and variables set within the “snapshot_and_revert” role.

tripleo_controller_group_name: "{{ controller_group_name | default('Controller') }}"
tripleo_compute_group_name: "{{ compute_group_name | default('Compute') }}"

tripleo_snapshot_revert_audit_size: 512M
tripleo_snapshot_revert_home_size: 512M
tripleo_snapshot_revert_log_size: 1G
tripleo_snapshot_revert_root_size: 2G
tripleo_snapshot_revert_srv_size: 512M
tripleo_snapshot_revert_var_size: 3G

# These parameters ensure that nodes are taken out from Pacemaker cluster
# before taking a snapshot, one node at a time to not cause any downtimes.
tripleo_snapshot_revert_snapshot_inactive_nodes: "{{ snapshot_inactive_nodes | default('true')\
  \ }}"
tripleo_snapshot_revert_pcs_timeout: 3600

Molecule Scenarios

Molecule is being used to test the “snapshot_and_revert” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.

Scenario: default

Driver: delegated
Molecule Options
managed: false
login_cmd_template: >-
  ssh
  -o UserKnownHostsFile=/dev/null
  -o StrictHostKeyChecking=no
  -o Compression=no
  -o TCPKeepAlive=yes
  -o VerifyHostKeyDNS=no
  -o ForwardX11=no
  -o ForwardAgent=no
  {instance}
ansible_connection_options:
  ansible_connection: ssh
Molecule Inventory
hosts:
  all:
    hosts:
      instance:
        ansible_host: localhost
Example default playbook
- name: Converge
  become: true
  hosts: all
  tasks:
  - name: Include snapshot_and_revert
    include_role:
      name: snapshot_and_revert

Usage

This Ansible role allows to do the following tasks:

  1. Take LVM snapshots in both the Controller and Compute nodes.

  2. Revert the state to the previously created snapshots.

  3. Remove the snapshots.

LVM snapshots are a feature of Linux Logical Volume Manager (LVM) that allows users to create a temporary, read-only copy of a the logical volumes of the Overcloud nodes. The copy is a point-in-time representation of the original volume and can be used for various purposes like data backup, testing, and recovery. The ext4 file system must be used on top of LVM logical volumes, otherwise this feature can not be used.

This example is meant to describe a very simple use case in which the user needs to create a set of recovery LVM snapshots from the Controller and Compute nodes.

Login in the Undercloud node and run:

# Create snapshots in the Compute and Controller nodes
openstack overcloud backup snapshot

To revert the snapshots run:

# Revert snapshots in the Compute and Controller nodes
openstack overcloud backup snapshot --revert

Then, to remove the created snapshots run:

# Remove snapshots in the Controller and Compute nodes
openstack overcloud backup snapshot --remove