| 1 | --- |
| 2 | - name: Create physical device |
| 3 | shell: pvcreate /dev/{{ item }} |
| 4 | with_items: "{{ device }}" |
| 5 | |
| 6 | - name: Create volume group |
| 7 | shell: vgcreate vg{{ item }} /dev/{{ item }} |
| 8 | with_items: "{{ device }}" |
| 9 | |
| 10 | - name: Create thin pool |
| 11 | shell: lvcreate -L 950M -T vg{{ item }}/thinpool |
| 12 | with_items: "{{ device }}" |
| 13 | |
| 14 | - name: Create thin volume |
| 15 | shell: lvcreate -V900M -T vg{{ item }}/thinpool -n thinp1 |
| 16 | with_items: "{{ device }}" |
| 17 | |
| 18 | - name: Format backend |
| 19 | filesystem: fstype=xfs dev=/dev/vg{{ item }}/thinp1 |
| 20 | with_items: "{{ device }}" |
| 21 | |
| 22 | - name: Create mount directory |
| 23 | file: path=/bricks/br{{ item }} state=directory recurse=yes |
| 24 | with_items: "{{ device }}" |
| 25 | |
| 26 | - name: Add entry to fstab and mount |
| 27 | mount: name=/bricks/br{{ item }} src=/dev/vg{{ item }}/thinp1 fstype=xfs state=mounted |
| 28 | with_items: "{{ device }}" |
| 29 | |
| 30 |