1- name: filesystem creation 2 filesystem: 3 dev: '{{ dev }}' 4 fstype: '{{ fstype }}' 5 register: fs_result 6 7- assert: 8 that: 9 - 'fs_result is changed' 10 - 'fs_result is success' 11 12- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}' 13 register: uuid 14 15- name: "Check that filesystem isn't created if force isn't used" 16 filesystem: 17 dev: '{{ dev }}' 18 fstype: '{{ fstype }}' 19 register: fs2_result 20 21- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}' 22 register: uuid2 23 24- assert: 25 that: 26 - 'not (fs2_result is changed)' 27 - 'fs2_result is success' 28 - 'uuid.stdout == uuid2.stdout' 29 30- name: Check that filesystem is recreated if force is used 31 filesystem: 32 dev: '{{ dev }}' 33 fstype: '{{ fstype }}' 34 force: yes 35 register: fs3_result 36 37- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}' 38 register: uuid3 39 40- assert: 41 that: 42 - 'fs3_result is changed' 43 - 'fs3_result is success' 44 - 'uuid.stdout != uuid3.stdout' 45 46- name: increase fake device 47 shell: 'dd if=/dev/zero bs=1M count=1 >> {{ image_file }}' 48 49- when: fstype == 'lvm' 50 block: 51 - name: Resize loop device for LVM 52 command: losetup -c {{ dev }} 53 54- when: 'grow|bool and (fstype != "vfat" or resize_vfat)' 55 block: 56 - name: Expand filesystem 57 filesystem: 58 dev: '{{ dev }}' 59 fstype: '{{ fstype }}' 60 resizefs: yes 61 register: fs4_result 62 63 - command: 'blkid -c /dev/null -o value -s UUID {{ dev }}' 64 register: uuid4 65 66 - assert: 67 that: 68 - 'fs4_result is changed' 69 - 'fs4_result is success' 70 - 'uuid3.stdout == uuid4.stdout' # unchanged 71 72 - name: Try to expand filesystem again 73 filesystem: 74 dev: '{{ dev }}' 75 fstype: '{{ fstype }}' 76 resizefs: yes 77 register: fs5_result 78 79 - assert: 80 that: 81 - 'not (fs5_result is changed)' 82 - 'fs5_result is successful' 83