-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
123 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
breaking_changes: | ||
- Split lvm_snapshots role into create_snapshot, revert_snapshot and remove_snapshot | ||
- Split lvm_snapshots role into snapshot_create, snapshot_revert and snapshot_remove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
create_snapshot_volumes: [] | ||
create_snapshot_boot_backup: false | ||
snapshot_create_volumes: [] | ||
snapshot_create_boot_backup: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }}'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
# 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: | ||
|
||
`<Origin LV name>_<revert_snapshot_set_name>` | ||
`<Origin LV name>_<snapshot_revert_set_name>` | ||
|
||
This naming convention will be used to identify the snapshots to be merged. | ||
|
||
The `revert` action will verify that all snapshots in the set are still active state before doing any merges. This is to prevent rolling back if any snapshots have become invalidated in which case the `revert` action should fail. | ||
|
||
## 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 | ||
``` |
Oops, something went wrong.