Skip to content

Commit

Permalink
various changes
Browse files Browse the repository at this point in the history
  • Loading branch information
richm committed Jan 12, 2024
1 parent c34c167 commit a85d599
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 93 deletions.
66 changes: 35 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,43 @@ appended to the name of the LV when the snapshot is created.

If before running the role, the following LVs exist:

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home rhel -wi-ao---- 1.00g
root rhel -wi-ao---- 35.00g
swap rhel -wi-ao---- <3.88g
lv1_vg1 vg1 -wi-a----- 1.00g
lv2_vg1 vg1 -wi-a----- 40.00m
lv1_vg2 vg2 -wi-a----- 1.00g
lv2_vg2 vg2 -wi-a----- 80.00m
lv1_vg3 vg3 -wi-a----- 1.00g
lv3_vg3 vg3 -wi-a----- 120.00m
```
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home rhel -wi-ao---- 1.00g
root rhel -wi-ao---- 35.00g
swap rhel -wi-ao---- <3.88g
lv1_vg1 vg1 -wi-a----- 1.00g
lv2_vg1 vg1 -wi-a----- 40.00m
lv1_vg2 vg2 -wi-a----- 1.00g
lv2_vg2 vg2 -wi-a----- 80.00m
lv1_vg3 vg3 -wi-a----- 1.00g
lv3_vg3 vg3 -wi-a----- 120.00m
```

If the prefix is set to "a_" and the suffix is set to "_z", running the role will result
in the following:

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
a_home_z rhel swi-a-s--- 104.00m home 0.00
a_root_z rhel swi-a-s--- 3.50g root 0.01
a_swap_z rhel swi-a-s--- 400.00m swap 0.00
home rhel owi-aos--- 1.00g
root rhel owi-aos--- 35.00g
swap rhel owi-aos--- <3.88g
a_lv1_vg1_z vg1 swi-a-s--- 104.00m lv1_vg1 0.00
a_lv2_vg1_z vg1 swi-a-s--- 8.00m lv2_vg1 0.00
lv1_vg1 vg1 owi-a-s--- 1.00g
lv2_vg1 vg1 owi-a-s--- 40.00m
a_lv1_vg2_z vg2 swi-a-s--- 104.00m lv1_vg2 0.00
a_lv2_vg2_z vg2 swi-a-s--- 12.00m lv2_vg2 0.00
lv1_vg2 vg2 owi-a-s--- 1.00g
lv2_vg2 vg2 owi-a-s--- 80.00m
a_lv1_vg3_z vg3 swi-a-s--- 104.00m lv1_vg3 0.00
a_lv3_vg3_z vg3 swi-a-s--- 16.00m lv3_vg3 0.00
lv1_vg3 vg3 owi-a-s--- 1.00g
lv3_vg3 vg3 owi-a-s--- 120.00m
```
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
a_home_z rhel swi-a-s--- 104.00m home 0.00
a_root_z rhel swi-a-s--- 3.50g root 0.01
a_swap_z rhel swi-a-s--- 400.00m swap 0.00
home rhel owi-aos--- 1.00g
root rhel owi-aos--- 35.00g
swap rhel owi-aos--- <3.88g
a_lv1_vg1_z vg1 swi-a-s--- 104.00m lv1_vg1 0.00
a_lv2_vg1_z vg1 swi-a-s--- 8.00m lv2_vg1 0.00
lv1_vg1 vg1 owi-a-s--- 1.00g
lv2_vg1 vg1 owi-a-s--- 40.00m
a_lv1_vg2_z vg2 swi-a-s--- 104.00m lv1_vg2 0.00
a_lv2_vg2_z vg2 swi-a-s--- 12.00m lv2_vg2 0.00
lv1_vg2 vg2 owi-a-s--- 1.00g
lv2_vg2 vg2 owi-a-s--- 80.00m
a_lv1_vg3_z vg3 swi-a-s--- 104.00m lv1_vg3 0.00
a_lv3_vg3_z vg3 swi-a-s--- 16.00m lv3_vg3 0.00
lv1_vg3 vg3 owi-a-s--- 1.00g
lv3_vg3 vg3 owi-a-s--- 120.00m
```

### snapshot_lvm_percent_space_required

Expand All @@ -85,8 +89,8 @@ Note: LVM will round up size to full physical extent

### snapshot_lvm_all_vgs

This is required the default is true. If true the role will snapshot all VGs on the
target system.
This is a boolean value with default false. If true the role will snapshot
all VGs on the target system.

### snapshot_lvm_vg

Expand Down
7 changes: 0 additions & 7 deletions handlers/main.yml

This file was deleted.

2 changes: 1 addition & 1 deletion tasks/check_space.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
-p {{ snapshot_lvm_prefix | quote }} -s {{ snapshot_lvm_suffix | quote }}
register: snapshot_cmd
args:
executable: "{{ ansible_python.executable }}"
executable: "{{ __snapshot_python }}"
failed_when:
snapshot_cmd.rc != 0
2 changes: 1 addition & 1 deletion tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
snapshot.py clean -a -p {{ snapshot_lvm_prefix | quote }}
-s {{ snapshot_lvm_suffix | quote }}
args:
executable: "{{ ansible_python.executable }}"
executable: "{{ __snapshot_python }}"
register: snapshot_cmd
failed_when:
snapshot_cmd.rc != 0
2 changes: 1 addition & 1 deletion tasks/snapshot_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Snapshot All VGs
ansible.builtin.script: "{{ __cmd }}"
args:
executable: "{{ ansible_python.executable }}"
executable: "{{ __snapshot_python }}"
register: snapshot_cmd
vars:
__cmd: "{{ 'snapshot.py snapshot ' ~
Expand Down
2 changes: 1 addition & 1 deletion tasks/verify_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Verify snapshot clean is completed
ansible.builtin.script: "{{ __cmd }}"
args:
executable: "{{ ansible_python.executable }}"
executable: "{{ __snapshot_python }}"
register: snapshot_cmd
vars:
__cmd: "{{ 'snapshot.py clean ' ~
Expand Down
2 changes: 1 addition & 1 deletion tasks/verify_complete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Verify snapshots are completed
ansible.builtin.script: "{{ __cmd }}"
args:
executable: "{{ ansible_python.executable }}"
executable: "{{ __snapshot_python }}"
register: snapshot_cmd
vars:
__cmd: "{{ 'snapshot.py check ' ~
Expand Down
1 change: 0 additions & 1 deletion tests/roles/linux-system-roles.snapshot/handlers

This file was deleted.

1 change: 0 additions & 1 deletion tests/roles/linux-system-roles.snapshot/templates

This file was deleted.

11 changes: 5 additions & 6 deletions tests/tests_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
- name: Ensure that the role runs with default parameters
hosts: all
gather_facts: false # test that role works in this case
vars:
snapshot_lvm_action: check
snapshot_lvm_percent_space_required: 1
snapshot_lvm_prefix: a_
snapshot_lvm_suffix: _z
roles:
- linux-system-roles.snapshot
tasks:
- name: Check header for ansible_managed, fingerprint
include_tasks: tasks/check_header.yml
vars:
__file: /etc/snapshot.conf
__fingerprint: system_role:snapshot
6 changes: 0 additions & 6 deletions vars/CentOS_7.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/CentOS_8.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/CentOS_9.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/Fedora.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/RedHat_7.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/RedHat_8.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/RedHat_9.yml

This file was deleted.

2 changes: 2 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

__snapshot_packages: ["lvm2"]
__snapshot_services: []
# python to use on managed nodes for snapshot.py
__snapshot_python: /usr/bin/python3
# ansible_facts required by the role
__snapshot_required_facts:
- distribution
Expand Down

0 comments on commit a85d599

Please sign in to comment.