--- - name: creating lvm as per requirement hosts: nodes tasks: - block: - block: - name: create a lvm of required size lvol: vg: research state: present lv: data size: 1500m when: ansible_lvm.vgs.research.size_g == "2.00" - block: - name: printing message debug: msg: Requested size of lvm cannot be created as vg size is not that much - name: cretaing lvm of lesser size lvol: vg: research lv: data state: present size: 800m when: ansible_lvm.vgs.research.size_g == "1.07" when: ansible_lvm.vgs.research is defined - name: format the filesystem filesystem: device: /dev/mapper/research-data fstype: ext4 state: present ...