The hot_snapset role creates consistent snapshots of OpenStack instances in a
Hotstack deployment. It safely shuts down instances and creates OpenStack images
from them, enabling rapid deployment restoration and development workflows.
This role is designed to:
- Create consistent point-in-time snapshots of running OpenStack instances
- Safely shutdown instances before snapshot creation to ensure data integrity
- Generate uniquely tagged OpenStack images for easy identification and management
- Support parallel image creation for efficient processing
- Enable quick restoration of complex OpenShift deployments
- OpenStack cloud environment with image creation capabilities
- Python
openstacklibrary installed - Ansible collections:
openstack.cloudcommunity.general
- Instances to be snapshotted must be in SHUTOFF state
snapset_data(dict): Instance data structure containing instances to snapshotcontroller_ansible_host(dict): Ansible host information for the controller node
hotstack_work_dir(string): Working directory for hotstack operations- Default:
"{{ playbook_dir }}"
- Default:
os_cloud(string): OpenStack cloud name from clouds.yaml- Default:
"{{ lookup('ansible.builtin.env', 'OS_CLOUD') }}"
- Default:
snapset_data:
instances:
controller:
uuid: "instance-uuid"
role: "controller"
mac_address: "fa:16:9e:81:f6:5"
master0:
uuid: "instance-uuid"
role: "ocp_master"
mac_address: "fa:16:9e:81:f6:10"Each instance must have:
uuid: OpenStack instance UUIDrole: Instance role (controller, ocp_master, etc.)mac_address: MAC address for network identification
openstack.cloudcollectioncommunity.generalcollection
- Validation: Validates required variables and snapset data structure
- Controller Shutdown: Adds controller to inventory and shuts it down gracefully
- State Verification: Waits for all instances to reach SHUTOFF state
- Image Creation: Creates OpenStack images from instances in parallel
- Tagging: Tags images with metadata for identification
Created images follow the naming convention:
hotstack-{instance_name}-snapshot-{unique_id}
Each image is tagged with:
hotstack: General hotstack identifierhotstack-snapset: General hotstack-snapset identifiername={name}: Instance namerole={role}: Instance rolesnap_id={unique_id}: Unique snapshot set identifiermac_address={mac}: Original MAC address
---
- name: Create Hotstack SnapSet
hosts: localhost
gather_facts: true
roles:
- role: hot_snapset
vars:
controller_ansible_host:
name: "controller"
ansible_host: "192.168.1.100"
ansible_user: "cloud-user"
ansible_ssh_private_key_file: "~/.ssh/id_rsa"
snapset_data:
instances:
controller:
uuid: "6f4512de-f744-4979-8ab2-45f5461e304c"
role: "controller"
mac_address: "fa:16:9e:81:f6:5"
master0:
uuid: "7a5623ef-g855-5a8a-9bc3-56g6572f415d"
role: "ocp_master"
mac_address: "fa:16:9e:81:f6:10"This role is typically used as part of the complete hotstack snapshot workflow:
# Create full deployment with snapshots
ansible-playbook -i inventory.yml create-snapset.yml \
-e @scenarios/snapshot-sno/bootstrap_vars.yml \
-e @~/bootstrap_vars_overrides.yml \
-e @~/cloud-secrets.yamlThe role is called from 04-create-snapset.yml playbook after:
- Infrastructure setup (
01-infra.yml) - Controller bootstrap (
02-bootstrap_controller.yml) - OpenShift installation with snapshot preparation (
03-install_ocp.yml)
The role includes a custom Ansible module hotstack_snapset that handles:
- OpenStack connection management
- Instance state validation
- Parallel image creation with threading
- Image tagging and metadata management
- Error handling and validation
- All instances must be in SHUTOFF state before snapshot creation
- The role uses parallel processing to create multiple images simultaneously
- Images are created with a unique identifier to group them as a set
- Controller node is gracefully shut down as part of the process
- Snapshots preserve MAC addresses and role information for restoration
Harald Jensås hjensas@redhat.com