diff options
author | 2024-03-10 09:44:48 -0700 | |
---|---|---|
committer | 2024-03-10 09:44:48 -0700 | |
commit | f4380ef0b7798f3c4e61ea96b3c57cba9630e660 (patch) | |
tree | 3d01a8704c57d5a2aa62bb3b513d5ae6582061ed | |
parent | fix(install_gentoo): set puppet for service provider (diff) | |
download | ansible-f4380ef0b7798f3c4e61ea96b3c57cba9630e660.tar.gz ansible-f4380ef0b7798f3c4e61ea96b3c57cba9630e660.tar.bz2 ansible-f4380ef0b7798f3c4e61ea96b3c57cba9630e660.zip |
feat(install_gentoo): more disk control
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | group_vars/nvme-host.yml | 18 | ||||
-rw-r--r-- | group_vars/scsi-host.yml | 18 | ||||
-rw-r--r-- | roles/install_gentoo/tasks/disks.yml | 58 |
4 files changed, 57 insertions, 46 deletions
@@ -1,4 +1,11 @@ ## Gentoo Infra fast installing + +Host with 2x NVME: ``` -ansible-playbook -i NEWBOX.gentoo.org, -e hostname=NEWBOX -e puppet_autosign_token=... install_gentoo.yml --verbose +ansible-playbook -i NEWBOX.gentoo.org, -e hostname=NEWBOX -e puppet_autosign_token=... install_gentoo.yml --verbose -e @group_vars/nvme-host.yml +``` + +Host with 2x SCSI/SAS/SATA: +``` +ansible-playbook -i NEWBOX.gentoo.org, -e hostname=NEWBOX -e puppet_autosign_token=... install_gentoo.yml --verbose -e @group_vars/scsi-host.yml ``` diff --git a/group_vars/nvme-host.yml b/group_vars/nvme-host.yml new file mode 100644 index 0000000..00d7697 --- /dev/null +++ b/group_vars/nvme-host.yml @@ -0,0 +1,18 @@ +raw_disks: + - /dev/nvme0n1 + - /dev/nvme1n1 +part1_dev: + - /dev/nvme0n1p1 + - /dev/nvme1n1p1 +part2_dev: + - /dev/nvme0n1p2 + - /dev/nvme1n1p2 +part3_dev: + - /dev/nvme0n1p3 + - /dev/nvme1n1p3 +part4_dev: + - /dev/nvme0n1p4 + - /dev/nvme1n1p4 +part5_dev: + - /dev/nvme0n1p5 + - /dev/nvme1n1p5 diff --git a/group_vars/scsi-host.yml b/group_vars/scsi-host.yml new file mode 100644 index 0000000..5dc9330 --- /dev/null +++ b/group_vars/scsi-host.yml @@ -0,0 +1,18 @@ +raw_disks: + - /dev/sda + - /dev/sdb +part1_dev: + - /dev/sda1 + - /dev/sdb1 +part2_dev: + - /dev/sda2 + - /dev/sdb2 +part3_dev: + - /dev/sda3 + - /dev/sdb3 +part4_dev: + - /dev/sda4 + - /dev/sdb4 +part5_dev: + - /dev/sda5 + - /dev/sdb5 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: |