Finalize development of shrink_lv fix; Testing

This commit is contained in:
Chris Hammer 2025-01-08 12:38:23 -05:00
parent 078da59120
commit 0606ff81b2
2 changed files with 24 additions and 17 deletions

View File

@ -0,0 +1,13 @@
---
- name: Set device for mount
ansible.builtin.set_fact:
shrink_lv_set_device: "{{ ansible_facts['mounts'] | selectattr('device', 'equalto', item['device']) | first }}"
- name: Assert that the filesystem has shrunk
ansible.builtin.assert:
# yamllint disable-line rule:line-length
that: (shrink_lv_set_device['size_total'] | int) <= (item['size'] | ansible.builtin.human_to_bytes)
fail_msg: >
Logical Volume {{ item['device'] }} was NOT shrunk as requested.
success_msg: >
Logical Volume {{ item['device'] }} has been shrunk as requested.

View File

@ -43,12 +43,6 @@
- "!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.
- name: Check if device has shrunken successfully
ansible.builtin.include_tasks: check_if_shrunk.yml
loop: "{{ shrink_lv_devices }}"