diff options
Diffstat (limited to 'roles/install_gentoo/tasks/disks.yml')
-rw-r--r-- | roles/install_gentoo/tasks/disks.yml | 58 |
1 files changed, 13 insertions, 45 deletions
diff --git a/roles/install_gentoo/tasks/disks.yml b/roles/install_gentoo/tasks/disks.yml index 50db3c3..c712109 100644 --- a/roles/install_gentoo/tasks/disks.yml +++ b/roles/install_gentoo/tasks/disks.yml @@ -10,9 +10,7 @@ changed_when: false register: check_mounted_disk check_mode: no - loop: - - /dev/nvme0n1 - - /dev/nvme1n1 + loop: "{{ raw_disks }}" - name: debug ansible.builtin.debug: @@ -33,7 +31,7 @@ content: | label: gpt p1 : start=1MiB, size=1MiB, type=21686148-6449-6E6F-744E-656564454649, name=BIOS - p2 : start=2MiB, size=63MiB, type=uefi, name=EFI + p2 : start=2MiB, size=62MiB, type=uefi, name=EFI p3 : start=64MiB, size=448MiB, type=raid, name=BOOT p4 : start=512MiB, size=30GiB, type=raid, name=ROOT p5 : start=+, size=+, type=lvm, name=LVM @@ -41,47 +39,26 @@ - partition - name: partition disks - ansible.builtin.shell: "/usr/sbin/sfdisk {{ item }} </tmp/partition.sfdisk" - loop: - - /dev/nvme0n1 - - /dev/nvme1n1 + ansible.builtin.shell: "sfdisk {{ item }} </tmp/partition.sfdisk" + loop: "{{ raw_disks }}" tags: - partition - - - name: fact md1 devices - ansible.builtin.set_fact: - md1_dev: "{{ ansible_loop.allitems|join(' ') }}" - loop: - - /dev/nvme0n1p1 - - /dev/nvme1n1p1 - loop_control: - extended: true - tags: - - mdadm - - - name: fact md2 devices - ansible.builtin.set_fact: - md2_dev: "{{ ansible_loop.allitems|join(' ') }}" - loop: - - /dev/nvme0n1p2 - - /dev/nvme1n1p2 - loop_control: - extended: true - tags: - - mdadm + + - name: setup p1 # BIOS_BP + ansible.builtin.meta: noop - name: mdadm p2 - ansible.builtin.command: "mdadm --create -e 1.0 /dev/md2 --level=raid1 -n 2 {{ md2_dev }}" + ansible.builtin.command: "mdadm --create -e 1.0 /dev/md2 --level=raid1 -n 2 {{ part2_dev|join(' ') }}" tags: - mdadm - name: mdadm p3 - ansible.builtin.command: "mdadm --create -e 1.0 /dev/md3 --level=raid1 -n 2 {{ md3_dev }}" + ansible.builtin.command: "mdadm --create -e 1.0 /dev/md3 --level=raid1 -n 2 {{ part3_dev|join(' ') }}" tags: - mdadm - name: mdadm p4 - ansible.builtin.command: "mdadm --create -e 1.0 /dev/md4 --level=raid1 -n 2 {{ md4_dev }}" + ansible.builtin.command: "mdadm --create -e 1.0 /dev/md4 --level=raid1 -n 2 {{ part4_dev|join(' ') }}" tags: - mdadm @@ -107,27 +84,18 @@ - mkfs - name: format p5/pvcreate - ansible.builtin.command: "pvcreate {{ ansible_loop.allitems|join(' ') }}" - loop_control: - extended: true - loop: - - /dev/nvme0n1p5 - - /dev/nvme1n1p5 + ansible.builtin.command: "pvcreate {{ part5_dev|join(' ') }}" tags: - lvm - pvcreate - name: fact vgcreate PVs ansible.builtin.set_fact: - pvs: "{{ ansible_loop.allitems|join(' ') }}" - loop: - - /dev/nvme0n1p5 - - /dev/nvme1n1p5 - loop_control: - extended: true + pvs: "{{ part5_dev|join(' ') }}" tags: - lvm - vgcreate + #when: "{{ pvs }}" = "" - name: fact vgs ansible.builtin.set_fact: |