quick_test/check_device2.yml
2025-01-27 17:32:23 -05:00

35 lines
1.1 KiB
YAML

---
- name: Something
hosts: bigboot
become: false
gather_facts: true
vars:
shrink_lv_devices:
- device: "/dev/mapper/system-root"
size: 81229615104
- device: "/dev/mapper/system-applog"
size: 81229615104
tasks:
- name: Get the mount point info # noqa: ignore-errors
ansible.builtin.set_fact:
shrink_lv_mount_info: "{{ ansible_facts.mounts | selectattr('device', 'equalto', item.device) | first }}"
ignore_errors: true
loop: "{{ shrink_lv_devices }}"
- 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 }}'"