Skip to content

Commit

Permalink
Add validation that the requested volumes have shrunk per issue #46 -…
Browse files Browse the repository at this point in the history
… 'Validate shrink_lv after reboot' (#49)
  • Loading branch information
jchristianh committed Jan 10, 2024
1 parent 9edec75 commit a51d077
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions roles/shrink_lv/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,20 @@
ansible.builtin.file:
path: /usr/lib/dracut/modules.d/99shrink_lv
state: absent

- name: Retrieve mount points
ansible.builtin.setup:
gather_subset:
- "!all"
- "!min"
- mounts

- name: Assert that the filesystem has shrunk
ansible.builtin.assert:
# yamllint disable-line rule:line-length
that: (ansible_facts.mounts | selectattr('device', 'equalto', item.device) | map(attribute='size_total') | join | int) <= (item.size | ansible.builtin.human_to_bytes)
fail_msg: >
Logical Volume {{ item.device }} was not shrunk to {{ item.size }} as requested
success_msg: >
Logical Volume {{ item.device }} has been shrunk to {{ item.size }} as requested.
loop: "{{ shrink_lv_devices }}"

0 comments on commit a51d077

Please sign in to comment.