quick_test/check_device2.yml
2025-01-08 17:20:07 -05:00

30 lines
967 B
YAML

---
- name: Something
hosts: bigboot
become: false
gather_facts: true
vars:
shrink_lv_devices:
- device: "/dev/mapper/system-root"
size: 81229615104
tasks:
- name: Get the mount point info
ansible.builtin.set_fact:
shrink_lv_mount_info: "{{ ansible_facts.mounts | selectattr('device', 'equalto', shrink_lv_devices[0].device) }}"
- name: Debug shrink_lv_mount_info
ansible.builtin.debug:
var: shrink_lv_mount_info
# - name: Assert that the mount point exists
# ansible.builtin.assert:
# that: (shrink_lv_mount_info | length) >= 1
# fail_msg: "Mount point {{ shrink_lv_devices[0].device }} does not exist"
# - name: Assert that the filesystem is supported
# ansible.builtin.assert:
# that: shrink_lv_mount_info[0].fstype in ['ext4']
# fail_msg: "Unsupported filesystem '{{ shrink_lv_mount_info[0].fstype }}' on '{{ shrink_lv_devices[0].device }}'"