Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 1 | - name: Check if the disk is partitioned |
| 2 | stat: path={{ extra_disk_dev }}1 |
| 3 | register: device_stat |
| 4 | |
| 5 | - name: Set disk label |
| 6 | command: parted {{ extra_disk_dev }} mklabel msdos |
| 7 | when: device_stat.stat.exists == false |
| 8 | |
| 9 | - name: Create primary partition |
| 10 | command: parted {{ extra_disk_dev }} mkpart primary 1 100% |
| 11 | when: device_stat.stat.exists == false |
| 12 | |
| 13 | - name: Make filesystem |
| 14 | filesystem: |
| 15 | fstype: ext4 |
| 16 | dev: "{{ extra_disk_dev }}1" |
| 17 | |
| 18 | - name: Mount extra disk |
| 19 | mount: |
| 20 | name: /mnt |
| 21 | src: "{{ extra_disk_dev }}1" |
| 22 | fstype: ext4 |
| 23 | state: mounted |
| 24 | |
| 25 | - name: Create directories |
| 26 | file: |
| 27 | path: "{{ item.src }}" |
| 28 | state: directory |
| 29 | with_items: "{{ extra_disk_links }}" |
| 30 | |
| 31 | - name: Set up links |
| 32 | file: |
| 33 | src: "{{ item.src }}" |
| 34 | dest: "{{ item.dest }}" |
| 35 | state: link |
| 36 | with_items: "{{ extra_disk_links }}" |