diff --git a/README.md b/README.md index b9dff54..075fddf 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ This collection depends on the following collections These are the roles included in the collection. Follow the links below to see the detailed documentation and example playbooks for each role. -- [`create_snapshot`](./roles/create_snapshot/) - controls the creation for a defined set of LVM snapshot volumes -- [`remove_snapshot`](./roles/remove_snapshot/) - used to remove snapshots previously created using the `create_snapshot` role -- [`revert_snapshot`](./roles/revert_snapshot/) - used to revert to snapshots previously created using the `create_snapshot` role +- [`snapshot_create`](./roles/snapshot_create/) - controls the creation for a defined set of LVM snapshot volumes +- [`snapshot_remove`](./roles/snapshot_remove/) - used to remove snapshots previously created using the `snapshot_create` role +- [`snapshot_revert`](./roles/snapshot_revert/) - used to revert to snapshots previously created using the `snapshot_create` role - [`shrink_lv`](./roles/shrink_lv/) - controls decreasing logical volume size along with the filesystem - [`bigboot`](./roles/bigboot/) - controls increasing of the boot partition while moving, and shrinking if needed, the adjacent partition - [`initramfs`](./roles/initramfs/) - controls the atomic flow of building and using a temporary initramfs in a reboot and restoring the original one diff --git a/changelogs/fragments/split-lvm-snapshot_role.yml b/changelogs/fragments/split-lvm-snapshot_role.yml index 25d5238..1bc6d17 100644 --- a/changelogs/fragments/split-lvm-snapshot_role.yml +++ b/changelogs/fragments/split-lvm-snapshot_role.yml @@ -1,2 +1,2 @@ breaking_changes: -- Split lvm_snapshots role into create_snapshot, revert_snapshot and remove_snapshot \ No newline at end of file +- Split lvm_snapshots role into snapshot_create, snapshot_revert and snapshot_remove \ No newline at end of file diff --git a/roles/snapshot_create/README.md b/roles/snapshot_create/README.md index 1e8aadd..2112cfb 100644 --- a/roles/snapshot_create/README.md +++ b/roles/snapshot_create/README.md @@ -1,44 +1,44 @@ -# create_snapshot role +# snapshot_create role -The `create_snapshot` role is used to control the creation for a defined set of LVM snapshot volumes. +The `snapshot_create` role is used to control the creation for a defined set of LVM snapshot volumes. In addition, it can optionally save the Grub configuration and image files under /boot and configure settings to enable the LVM snapshot autoextend capability. -The role will verify free space and should fail if there is not enough or if any snapshots already exist for the given `create_snapshot_set_name`. +The role will verify free space and should fail if there is not enough or if any snapshots already exist for the given `snapshot_create_set_name`. The role is designed to support the automation of RHEL in-place upgrades, but can also be used to reduce the risk of more mundane system maintenance activities. ## Role Variables -### `create_snapshot_check_only` +### `snapshot_create_check_only` When set to `true` the role will only verify there is enough free space for the specified snapshots and not create them. Default `false` -### `create_snapshot_set_name` +### `snapshot_create_set_name` -The variable `create_snapshot_set_name` is used to identify the list of volumes to be operated upon. +The variable `snapshot_create_set_name` is used to identify the list of volumes to be operated upon. The role will use the following naming convention when creating the snapshots: -`_` +`_` -### `create_snapshot_boot_backup` +### `snapshot_create_boot_backup` Boolean to specify that the role should preserve the Grub configuration and image files under /boot required for booting the default kernel. -The files are preserved in a compressed tar archive at `/root/boot-backup-.tgz`. Default is `false`. +The files are preserved in a compressed tar archive at `/root/boot-backup-.tgz`. Default is `false`. > **Warning** > > When automating RHEL in-place upgrades, do not perform a Grub to Grub2 migration as part of your upgrade playbook. It will invalidate your boot backup and cause a subsequent `revert` action to fail. For example, if you are using the [`upgrade`](https://github.com/redhat-cop/infra.leapp/tree/main/roles/upgrade#readme) role from the [`infra.leapp`](https://github.com/redhat-cop/infra.leapp) collection, do not set `update_grub_to_grub_2` to `true`. Grub to Grub2 migration should only be performed after the `remove` action has been performed to delete the snapshots and boot backup. -### `create_snapshot_snapshot_autoextend_threshold` +### `snapshot_create_snapshot_autoextend_threshold` -Configure the given `create_snapshot_autoextend_threshold` setting in lvm.conf before creating snapshots. +Configure the given `snapshot_create_autoextend_threshold` setting in lvm.conf before creating snapshots. -### `create_snapshot_snapshot_autoextend_percent` +### `snapshot_create_snapshot_autoextend_percent` -Configure the given `create_snapshot_snapshot_autoextend_percent` setting in lvm.conf before creating snapshots. +Configure the given `snapshot_create_snapshot_autoextend_percent` setting in lvm.conf before creating snapshots. -### `create_snapshot_volumes` +### `snapshot_create_volumes` This is the list of logical volumes for which snapshots are to be created and the size requirements for those snapshots. The volumes list is only required when the role is run with the check or create action. @@ -69,12 +69,12 @@ Files under /boot will be preserved. ```yaml - hosts: all roles: - - name: create_snapshot - create_snapshot_set_name: ripu - create_snapshot_snapshot_autoextend_threshold: 70 - create_snapshot_snapshot_autoextend_percent: 20 - create_snapshot_boot_backup: true - create_snapshot_volumes: + - name: snapshot_create + snapshot_create_set_name: ripu + snapshot_create_snapshot_autoextend_threshold: 70 + snapshot_create_snapshot_autoextend_percent: 20 + snapshot_create_boot_backup: true + snapshot_create_volumes: - vg: rootvg lv: root size: 2G diff --git a/roles/snapshot_create/defaults/main.yml b/roles/snapshot_create/defaults/main.yml index a28c258..3cf2f17 100644 --- a/roles/snapshot_create/defaults/main.yml +++ b/roles/snapshot_create/defaults/main.yml @@ -1,2 +1,2 @@ -create_snapshot_volumes: [] -create_snapshot_boot_backup: false +snapshot_create_volumes: [] +snapshot_create_boot_backup: false diff --git a/roles/snapshot_create/tasks/check.yml b/roles/snapshot_create/tasks/check.yml index af46daf..405f820 100644 --- a/roles/snapshot_create/tasks/check.yml +++ b/roles/snapshot_create/tasks/check.yml @@ -1,26 +1,26 @@ - name: Verify that all volumes exist ansible.builtin.include_tasks: verify_volume_exists.yml - loop: "{{ create_snapshot_volumes }}" + loop: "{{ snapshot_create_volumes }}" - name: Verify that there are no existing snapshots ansible.builtin.include_tasks: verify_no_existing_snapshot.yml - loop: "{{ create_snapshot_volumes }}" + loop: "{{ snapshot_create_volumes }}" - name: Verify that there is enough storage space - ansible.builtin.script: check.py snapshots '{{ create_snapshot_volumes | to_json }}' + ansible.builtin.script: check.py snapshots '{{ snapshot_create_volumes | to_json }}' args: executable: "{{ ansible_python.executable }}" - register: create_snapshot_check_status + register: snapshot_create_check_status failed_when: false changed_when: false - name: Store check return in case of failure ansible.builtin.set_fact: - create_snapshot_check_failure_json: "{{ create_snapshot_check_status.stdout | from_json }}" - when: create_snapshot_check_status.rc != 0 + snapshot_create_check_failure_json: "{{ snapshot_create_check_status.stdout | from_json }}" + when: snapshot_create_check_status.rc != 0 - name: Assert results ansible.builtin.assert: - that: create_snapshot_check_status.rc == 0 + that: snapshot_create_check_status.rc == 0 fail_msg: Not enough space in the Volume Groups to create the requested snapshots success_msg: The Volume Groups have enough space to create the requested snapshots diff --git a/roles/snapshot_create/tasks/create.yml b/roles/snapshot_create/tasks/create.yml index 9b67457..4e87a83 100644 --- a/roles/snapshot_create/tasks/create.yml +++ b/roles/snapshot_create/tasks/create.yml @@ -2,21 +2,21 @@ block: - name: Stringify snapshot_autoextend_percent setting ansible.builtin.set_fact: - create_snapshot_snapshot_autoextend_percent_config: "activation/snapshot_autoextend_percent={{ create_snapshot_snapshot_autoextend_percent }}" - when: create_snapshot_snapshot_autoextend_percent is defined + snapshot_create_snapshot_autoextend_percent_config: "activation/snapshot_autoextend_percent={{ snapshot_create_snapshot_autoextend_percent }}" + when: snapshot_create_snapshot_autoextend_percent is defined - name: Stringify snapshot_autoextend_threshold setting ansible.builtin.set_fact: - create_snapshot_snapshot_autoextend_threshold_config: "activation/snapshot_autoextend_threshold={{ create_snapshot_snapshot_autoextend_threshold }}" - when: create_snapshot_snapshot_autoextend_threshold is defined + snapshot_create_snapshot_autoextend_threshold_config: "activation/snapshot_autoextend_threshold={{ snapshot_create_snapshot_autoextend_threshold }}" + when: snapshot_create_snapshot_autoextend_threshold is defined - name: Stringify the new config ansible.builtin.set_fact: - create_snapshot_new_lvm_config: > - {{ create_snapshot_snapshot_autoextend_percent_config | default('') }} - {{ create_snapshot_snapshot_autoextend_threshold_config | default('') }} + snapshot_create_new_lvm_config: > + {{ snapshot_create_snapshot_autoextend_percent_config | default('') }} + {{ snapshot_create_snapshot_autoextend_threshold_config | default('') }} - name: Set LVM configuration - ansible.builtin.command: 'lvmconfig --mergedconfig --config "{{ create_snapshot_new_lvm_config }}" --file /etc/lvm/lvm.conf' + ansible.builtin.command: 'lvmconfig --mergedconfig --config "{{ snapshot_create_new_lvm_config }}" --file /etc/lvm/lvm.conf' changed_when: true - when: ((create_snapshot_new_lvm_config | trim) | length) > 0 + when: ((snapshot_create_new_lvm_config | trim) | length) > 0 - name: Check for grubenv saved_entry ansible.builtin.lineinfile: @@ -26,20 +26,20 @@ check_mode: true changed_when: false failed_when: false - register: create_snapshot_grubenv + register: snapshot_create_grubenv - name: Add grubenv saved_entry ansible.builtin.shell: 'grubby --set-default-index=$(grubby --default-index)' changed_when: true - when: create_snapshot_grubenv.found is defined and create_snapshot_grubenv.found == 0 + when: snapshot_create_grubenv.found is defined and snapshot_create_grubenv.found == 0 - name: Create snapshots community.general.lvol: vg: "{{ item.vg }}" lv: "{{ item.lv }}" - snapshot: "{{ item.lv }}_{{ create_snapshot_set_name }}" + snapshot: "{{ item.lv }}_{{ snapshot_create_set_name }}" size: "{{ item.size | default(omit) }}" - loop: "{{ create_snapshot_volumes }}" + loop: "{{ snapshot_create_volumes }}" - name: Required packages are present ansible.builtin.package: @@ -52,7 +52,7 @@ community.general.archive: format: gz mode: '0644' - dest: "/root/boot-backup-{{ create_snapshot_set_name }}.tgz" + dest: "/root/boot-backup-{{ snapshot_create_set_name }}.tgz" path: - "/boot/initramfs-{{ ansible_kernel }}.img" - "/boot/vmlinuz-{{ ansible_kernel }}" @@ -65,4 +65,4 @@ - /boot/grub2/grubenv - /boot/loader/entries - /boot/efi/EFI/redhat/grub.cfg - when: create_snapshot_boot_backup + when: snapshot_create_boot_backup diff --git a/roles/snapshot_create/tasks/main.yml b/roles/snapshot_create/tasks/main.yml index 91f2411..87e8fc8 100644 --- a/roles/snapshot_create/tasks/main.yml +++ b/roles/snapshot_create/tasks/main.yml @@ -3,6 +3,6 @@ - name: Create Snapshot vars: - create_snapshot_volumes: "{{ create_snapshot_check_status.stdout | from_json }}" + snapshot_create_volumes: "{{ snapshot_create_check_status.stdout | from_json }}" ansible.builtin.include_tasks: create.yml - when: not (create_snapshot_check_only | default(false)) + when: not (snapshot_create_check_only | default(false)) diff --git a/roles/snapshot_create/tasks/verify_no_existing_snapshot.yml b/roles/snapshot_create/tasks/verify_no_existing_snapshot.yml index dbc4aea..cd8c218 100644 --- a/roles/snapshot_create/tasks/verify_no_existing_snapshot.yml +++ b/roles/snapshot_create/tasks/verify_no_existing_snapshot.yml @@ -3,19 +3,19 @@ lvs --select 'vg_name = {{ item.vg }} && origin = {{ item.lv }} - && lv_name = {{ item.lv }}_{{ create_snapshot_set_name }}' + && lv_name = {{ item.lv }}_{{ snapshot_create_set_name }}' --reportformat json - register: create_snapshot_lvs_response + register: snapshot_create_lvs_response changed_when: false - name: Parse report ansible.builtin.set_fact: - create_snapshot_lv_snapshot_report_array: "{{ (create_snapshot_lvs_response.stdout | from_json).report[0].lv }}" + snapshot_create_lv_snapshot_report_array: "{{ (snapshot_create_lvs_response.stdout | from_json).report[0].lv }}" - name: Verify that the no snapshot exists for the volume ansible.builtin.assert: - that: (create_snapshot_lv_snapshot_report_array | length) == 0 + that: (snapshot_create_lv_snapshot_report_array | length) == 0 fail_msg: > The volume '{{ item.lv }}' in volume group '{{ item.vg }}' already has at least one snapshot - '{{ create_snapshot_lv_snapshot_report_array[0].lv_name | default('none') }}' + '{{ snapshot_create_lv_snapshot_report_array[0].lv_name | default('none') }}' diff --git a/roles/snapshot_create/tasks/verify_volume_exists.yml b/roles/snapshot_create/tasks/verify_volume_exists.yml index 198c336..0e2c177 100644 --- a/roles/snapshot_create/tasks/verify_volume_exists.yml +++ b/roles/snapshot_create/tasks/verify_volume_exists.yml @@ -1,9 +1,9 @@ - name: Run lvs ansible.builtin.command: "lvs --select 'vg_name = {{ item.vg }} && lv_name = {{ item.lv }}' --reportformat json" - register: create_snapshot_lvs_response + register: snapshot_create_lvs_response changed_when: false - name: Verify that the volume was found ansible.builtin.assert: - that: (((create_snapshot_lvs_response.stdout | from_json).report[0].lv) | length) > 0 + that: (((snapshot_create_lvs_response.stdout | from_json).report[0].lv) | length) > 0 fail_msg: "Could not find volume '{{ item.lv }}' in volume group '{{ item.vg }}'" diff --git a/roles/snapshot_remove/README.md b/roles/snapshot_remove/README.md index 0b40549..aed52d1 100644 --- a/roles/snapshot_remove/README.md +++ b/roles/snapshot_remove/README.md @@ -1,19 +1,19 @@ -# remove_snapshot role +# snapshot_remove role -The `remove_snapshot` role is used to remove snapshots. +The `snapshot_remove` role is used to remove snapshots. In addition, it removes the Grub configuration and image files under /boot if it was previously backed up -It is intended to be used along with the `create_snapshot` role. +It is intended to be used along with the `snapshot_create` role. The role is designed to support the automation of RHEL in-place upgrades, but can also be used to reduce the risk of more mundane system maintenance activities. ## Role Variables -### `remove_snapshot_set_name` +### `snapshot_remove_set_name` -The variable `remove_snapshot_set_name` is used to identify the list of volumes to be operated upon. +The variable `snapshot_remove_set_name` is used to identify the list of volumes to be operated upon. The role will use the following naming convention when reverting the snapshots: -`_` +`_` This naming convention will be used to identify the snapshots to be removed. @@ -27,6 +27,6 @@ Each snapshot in the snapshot set is removed and the backed up image files from ```yaml - hosts: all roles: - - name: remove_snapshot - remove_snapshot_set_name: ripu + - name: snapshot_remove + snapshot_remove_set_name: ripu ``` diff --git a/roles/snapshot_remove/tasks/main.yml b/roles/snapshot_remove/tasks/main.yml index 7a76699..01ce3ea 100644 --- a/roles/snapshot_remove/tasks/main.yml +++ b/roles/snapshot_remove/tasks/main.yml @@ -1,12 +1,12 @@ - name: Calculate the list of snapshots block: - name: Get list of volumes - ansible.builtin.command: "lvs --select 'lv_name =~ {{ remove_snapshot_set_name }}$ && origin != \"\"' --reportformat json " - register: remove_snapshot_lvs_response + ansible.builtin.command: "lvs --select 'lv_name =~ {{ snapshot_remove_set_name }}$ && origin != \"\"' --reportformat json " + register: snapshot_remove_lvs_response changed_when: false - name: Get LV dict List ansible.builtin.set_fact: - remove_snapshot_snapshots: "{{ (remove_snapshot_lvs_response.stdout | from_json).report[0].lv }}" + snapshot_remove_snapshots: "{{ (snapshot_remove_lvs_response.stdout | from_json).report[0].lv }}" - name: Remove snapshots community.general.lvol: @@ -15,9 +15,9 @@ lv: "{{ item.origin }}" snapshot: "{{ item.lv_name }}" force: true - loop: "{{ remove_snapshot_snapshots }}" + loop: "{{ snapshot_remove_snapshots }}" - name: Remove boot backup ansible.builtin.file: - path: "/root/boot-backup-{{ remove_snapshot_set_name }}.tgz" + path: "/root/boot-backup-{{ snapshot_remove_set_name }}.tgz" state: absent diff --git a/roles/snapshot_revert/README.md b/roles/snapshot_revert/README.md index fa51380..ef8adf8 100644 --- a/roles/snapshot_revert/README.md +++ b/roles/snapshot_revert/README.md @@ -1,22 +1,22 @@ -# revert_snapshot role +# snapshot_revert role -The `revert_snapshot` role is used to merge snapshots to origin and reboot (i.e., rollback). +The `snapshot_revert` role is used to merge snapshots to origin and reboot (i.e., rollback). The role will verify that all snapshots in the set are still in active state before doing any merges. This is to prevent rolling back if any snapshots have become invalidated in which case the role should fail. In addition, it restores the Grub configuration and image files under /boot is it was previously backed up -It is intended to be used along with the `create_snapshot` role. +It is intended to be used along with the `snapshot_create` role. The role is designed to support the automation of RHEL in-place upgrades, but can also be used to reduce the risk of more mundane system maintenance activities. ## Role Variables -### `revert_snapshot_set_name` +### `snapshot_revert_set_name` -The variable `revert_snapshot_set_name` is used to identify the list of volumes to be operated upon. +The variable `snapshot_revert_set_name` is used to identify the list of volumes to be operated upon. The role will use the following naming convention when reverting the snapshots: -`_` +`_` This naming convention will be used to identify the snapshots to be merged. @@ -24,13 +24,13 @@ The `revert` action will verify that all snapshots in the set are still active s ## Example Playbooks -This playbook rolls back the host using the snapshots created using the `create_snapshot` role. +This playbook rolls back the host using the snapshots created using the `snapshot_create` role. After verifying that all snapshots are still valid, each logical volume in the snapshot set is merged. The image files under /boot will be restored and then the host will be rebooted. ```yaml - hosts: all roles: - - name: revert_snapshot - revert_snapshot_set_name: ripu + - name: snapshot_revert + snapshot_revert_set_name: ripu ``` diff --git a/roles/snapshot_revert/tasks/main.yml b/roles/snapshot_revert/tasks/main.yml index e19e7d9..536e62a 100644 --- a/roles/snapshot_revert/tasks/main.yml +++ b/roles/snapshot_revert/tasks/main.yml @@ -1,16 +1,16 @@ - name: Calculate the list of snapshots block: - name: Get list of volumes - ansible.builtin.command: "lvs --select 'lv_name =~ {{ revert_snapshot_set_name }}$ && origin != \"\"' --reportformat json " - register: revert_snapshot_lvs_response + ansible.builtin.command: "lvs --select 'lv_name =~ {{ snapshot_revert_set_name }}$ && origin != \"\"' --reportformat json " + register: snapshot_revert_lvs_response changed_when: false - name: Get LV dict List ansible.builtin.set_fact: - revert_snapshot_snapshots: "{{ (revert_snapshot_lvs_response.stdout | from_json).report[0].lv }}" + snapshot_revert_snapshots: "{{ (snapshot_revert_lvs_response.stdout | from_json).report[0].lv }}" - name: Verify that all snapshots are active ansible.builtin.include_tasks: verify_snapshot_active.yml - loop: "{{ revert_snapshot_snapshots }}" + loop: "{{ snapshot_revert_snapshots }}" - name: Required packages are present ansible.builtin.package: @@ -21,19 +21,19 @@ - name: Check if Boot backup exists ansible.builtin.stat: - path: "/root/boot-backup-{{ revert_snapshot_set_name }}.tgz" - register: revert_snapshot_boot_archive_stat + path: "/root/boot-backup-{{ snapshot_revert_set_name }}.tgz" + register: snapshot_revert_boot_archive_stat - name: Restore boot backup ansible.builtin.unarchive: remote_src: true - src: "{{ revert_snapshot_boot_archive_stat.stat.path }}" + src: "{{ snapshot_revert_boot_archive_stat.stat.path }}" dest: /boot - when: revert_snapshot_boot_archive_stat.stat.exists + when: snapshot_revert_boot_archive_stat.stat.exists - name: Revert to snapshots ansible.builtin.command: "lvconvert --merge /dev/{{ item.vg_name }}/{{ item.lv_name }}" - loop: "{{ revert_snapshot_snapshots }}" + loop: "{{ snapshot_revert_snapshots }}" changed_when: false - name: Reboot @@ -43,31 +43,31 @@ ansible.builtin.command: "grub2-probe --target=abstraction /boot" changed_when: false failed_when: false - register: revert_snapshot_boot_abstraction + register: snapshot_revert_boot_abstraction - name: Reinstall Grub to boot device - when: revert_snapshot_boot_abstraction.stdout == 'lvm' + when: snapshot_revert_boot_abstraction.stdout == 'lvm' block: - name: Get boot device ansible.builtin.shell: "lsblk -spnlo name $(grub2-probe --target=device /boot)" changed_when: false - register: revert_snapshot_boot_dev_deps + register: snapshot_revert_boot_dev_deps - name: Run grub2-install - ansible.builtin.command: "grub2-install {{ revert_snapshot_boot_dev_deps.stdout_lines | last }}" + ansible.builtin.command: "grub2-install {{ snapshot_revert_boot_dev_deps.stdout_lines | last }}" changed_when: true - name: Remove boot backup ansible.builtin.file: - path: "{{ revert_snapshot_boot_archive_stat.stat.path }}" + path: "{{ snapshot_revert_boot_archive_stat.stat.path }}" state: absent - when: revert_snapshot_boot_archive_stat.stat.exists + when: snapshot_revert_boot_archive_stat.stat.exists - name: Wait for the snapshot to drain ansible.builtin.command: "lvs --select 'vg_name = {{ item.vg_name }} && lv_name = {{ item.origin }}' --reportformat json" - register: revert_snapshot_lv_drain_check - until: (revert_snapshot_lv_drain_check.stdout | from_json).report[0].lv[0].data_percent == "" + register: snapshot_revert_lv_drain_check + until: (snapshot_revert_lv_drain_check.stdout | from_json).report[0].lv[0].data_percent == "" retries: 20 delay: 30 - loop: "{{ revert_snapshot_snapshots }}" + loop: "{{ snapshot_revert_snapshots }}" changed_when: false diff --git a/roles/snapshot_revert/tasks/verify_snapshot_active.yml b/roles/snapshot_revert/tasks/verify_snapshot_active.yml index 1e41dd4..82f6a72 100644 --- a/roles/snapshot_revert/tasks/verify_snapshot_active.yml +++ b/roles/snapshot_revert/tasks/verify_snapshot_active.yml @@ -1,14 +1,14 @@ - name: Run lvs ansible.builtin.command: "lvs --select 'lv_name = {{ item.lv_name }}' --reportformat json" - register: revert_snapshot_lvs_response + register: snapshot_revert_lvs_response changed_when: false - name: Parse report ansible.builtin.set_fact: - revert_snapshot_lv_attr: "{{ (revert_snapshot_lvs_response.stdout | from_json).report[0].lv[0].lv_attr }}" + snapshot_revert_lv_attr: "{{ (snapshot_revert_lvs_response.stdout | from_json).report[0].lv[0].lv_attr }}" - name: Verify that the snapshot is active ansible.builtin.assert: that: - - revert_snapshot_lv_attr[0] == 's' - - revert_snapshot_lv_attr[4] == 'a' + - snapshot_revert_lv_attr[0] == 's' + - snapshot_revert_lv_attr[4] == 'a' diff --git a/tests/create-snapshot.yml b/tests/create-snapshot.yml index 6d96e30..f99e1de 100644 --- a/tests/create-snapshot.yml +++ b/tests/create-snapshot.yml @@ -5,10 +5,10 @@ - name: Create the snapshot vars: - create_snapshot_volumes: "{{ _snapshots }}" - create_snapshot_set_name: "{{ snapshot_set_name }}" + snapshot_create_volumes: "{{ _snapshots }}" + snapshot_create_set_name: "{{ snapshot_set_name }}" ansible.builtin.include_role: - name: create_snapshot + name: snapshot_create - name: Verify that the snapshot was created ansible.builtin.include_tasks: verify-snapshot-created.yml diff --git a/tests/test-create-snapshot-from-free-playbook.yml b/tests/test-create-snapshot-from-free-playbook.yml index 1da6fe0..261d553 100644 --- a/tests/test-create-snapshot-from-free-playbook.yml +++ b/tests/test-create-snapshot-from-free-playbook.yml @@ -49,9 +49,9 @@ always: - name: Remove Snapshot vars: - remove_snapshot_set_name: "{{ snapshot_set_name }}" + snapshot_remove_set_name: "{{ snapshot_set_name }}" ansible.builtin.include_role: - name: remove_snapshot + name: snapshot_remove - name: Cleanup vars: volumes: diff --git a/tests/test-drain-snapshot.yml b/tests/test-drain-snapshot.yml index a16f9e6..18fb362 100644 --- a/tests/test-drain-snapshot.yml +++ b/tests/test-drain-snapshot.yml @@ -24,9 +24,9 @@ - name: Revert to Snapshot vars: - revert_snapshot_set_name: "{{ snapshot_set_name }}" + snapshot_revert_set_name: "{{ snapshot_set_name }}" ansible.builtin.include_role: - name: revert_snapshot + name: snapshot_revert - name: Verify that the snapshot was completely drained block: diff --git a/tests/test-remove-playbook.yml b/tests/test-remove-playbook.yml index fc34fb7..7724be9 100644 --- a/tests/test-remove-playbook.yml +++ b/tests/test-remove-playbook.yml @@ -8,8 +8,8 @@ size: 1g directory: /mnt/test snapshot_set_name: demo_snap - create_snapshot_snapshot_autoextend_threshold: 80 - create_snapshot_snapshot_autoextend_percent: 15 + snapshot_create_snapshot_autoextend_threshold: 80 + snapshot_create_snapshot_autoextend_percent: 15 tasks: - name: Run pre-test steps ansible.builtin.include_tasks: pre-test-tasks.yml @@ -19,9 +19,9 @@ - name: Remove Snapshot vars: - remove_snapshot_set_name: "{{ snapshot_set_name }}" + snapshot_remove_set_name: "{{ snapshot_set_name }}" ansible.builtin.include_role: - name: remove_snapshot + name: snapshot_remove - name: Verify that the snapshot no longer exist vars: diff --git a/tests/test-revert-playbook.yml b/tests/test-revert-playbook.yml index 41a0e22..3494a9b 100644 --- a/tests/test-revert-playbook.yml +++ b/tests/test-revert-playbook.yml @@ -41,9 +41,9 @@ - name: Revert to Snapshot vars: - revert_snapshot_set_name: "{{ snapshot_set_name }}" + snapshot_revert_set_name: "{{ snapshot_set_name }}" ansible.builtin.include_role: - name: revert_snapshot + name: snapshot_revert - name: Verify that the file no longer exist block: diff --git a/tests/test-snapshot-too-big-playbook.yml b/tests/test-snapshot-too-big-playbook.yml index 861d134..fb352a5 100644 --- a/tests/test-snapshot-too-big-playbook.yml +++ b/tests/test-snapshot-too-big-playbook.yml @@ -8,8 +8,8 @@ size: 8g directory: /mnt/test snapshot_set_name: demo_snap - create_snapshot_snapshot_autoextend_threshold: 80 - create_snapshot_snapshot_autoextend_percent: 15 + snapshot_create_snapshot_autoextend_threshold: 80 + snapshot_create_snapshot_autoextend_percent: 15 tasks: - name: Run pre-test steps ansible.builtin.include_tasks: pre-test-tasks.yml @@ -27,13 +27,13 @@ ansible.builtin.include_tasks: post-test-tasks.yml - name: Print the failure JSON if exists ansible.builtin.debug: - var: create_snapshot_check_failure_json - when: create_snapshot_check_failure_json is defined + var: snapshot_create_check_failure_json + when: snapshot_create_check_failure_json is defined - name: Check results ansible.builtin.assert: that: - - create_snapshot_check_failure_json is defined - - create_snapshot_check_failure_json.test_vg - - create_snapshot_check_failure_json.test_vg.size == 9646899200 - - create_snapshot_check_failure_json.test_vg.free == 1056964608 - - create_snapshot_check_failure_json.test_vg.requested_size == 8589934592 + - snapshot_create_check_failure_json is defined + - snapshot_create_check_failure_json.test_vg + - snapshot_create_check_failure_json.test_vg.size == 9646899200 + - snapshot_create_check_failure_json.test_vg.free == 1056964608 + - snapshot_create_check_failure_json.test_vg.requested_size == 8589934592