From 77e606396005bafc3f78ca29f7f672857f6bf942 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 25 Jun 2020 01:46:47 +0200 Subject: add ch-oulu testserver for preseed partitioning --- inventory/group_vars/chaos-at-home/network.yml | 1 + inventory/host_vars/ch-oulu.yml | 17 +++++++++++++++++ inventory/hosts.ini | 1 + 3 files changed, 19 insertions(+) create mode 100644 inventory/host_vars/ch-oulu.yml (limited to 'inventory') diff --git a/inventory/group_vars/chaos-at-home/network.yml b/inventory/group_vars/chaos-at-home/network.yml index f33235d1..5b078528 100644 --- a/inventory/group_vars/chaos-at-home/network.yml +++ b/inventory/group_vars/chaos-at-home/network.yml @@ -12,6 +12,7 @@ network_zones: limit: 199 offsets: ch-equinox-ws: 1 + ch-oulu: 2 ch-auth: 88 ch-prometheus: 99 ch-prometheus-old: 250 diff --git a/inventory/host_vars/ch-oulu.yml b/inventory/host_vars/ch-oulu.yml new file mode 100644 index 00000000..b5b86138 --- /dev/null +++ b/inventory/host_vars/ch-oulu.yml @@ -0,0 +1,17 @@ +--- +install: + efi: true + disks: + primary: /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800161Z + # primary: /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800191M + +network: + nameservers: + - 9.9.9.9 + domain: "{{ host_domain }}" + primary: &_network_primary_ + name: eno1 + address: "{{ network_zones.lan.prefix | ipaddr(network_zones.lan.offsets[inventory_hostname]) | ipaddr('address/prefix') }}" + gateway: "{{ network_zones.lan.gateway }}" + interfaces: + - *_network_primary_ diff --git a/inventory/hosts.ini b/inventory/hosts.ini index 3718d7d2..bd6add33 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -28,6 +28,7 @@ ch-nic host_name=nic ch-hroottest host_name=hroot-test ch-hroottest-vm1 host_name=hroot-test-vm1 ch-hroottest-obsd host_name=hroot-test-obsd +ch-oulu host_name=oulu host_domain=helsinki.at [chaos-at-home:children] mz-chaos-at-home -- cgit v1.2.3 From fe132141119ff30b8400db4b0cd43cb1b19109f6 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 28 Jun 2020 16:05:37 +0200 Subject: cloud-install: new raid disk layout config --- inventory/host_vars/ch-hroottest.yml | 7 ++++++- inventory/host_vars/sk-2019.yml | 7 ++++++- inventory/host_vars/sk-2019vm.yml | 7 ++++++- inventory/host_vars/sk-cloudia/vars.yml | 7 ++++++- inventory/host_vars/sk-testvm.yml | 4 ++++ inventory/host_vars/sk-tomnext.yml | 7 ++++++- .../cloud/install/templates/hetzner_installimage.conf.j2 | 16 +++++++--------- 7 files changed, 41 insertions(+), 14 deletions(-) (limited to 'inventory') diff --git a/inventory/host_vars/ch-hroottest.yml b/inventory/host_vars/ch-hroottest.yml index 7c08fe04..4ed4449f 100644 --- a/inventory/host_vars/ch-hroottest.yml +++ b/inventory/host_vars/ch-hroottest.yml @@ -4,7 +4,12 @@ install: credentials: "{{ vault_hroot_robot_account }}" server_name: "{{ host_name }}" disks: - layout: sata_raid + primary: software-raid + raid: + level: 1 + members: + - /dev/sda + - /dev/sdb root_lvm_size: 10G network: diff --git a/inventory/host_vars/sk-2019.yml b/inventory/host_vars/sk-2019.yml index 5bba107a..353fe8c1 100644 --- a/inventory/host_vars/sk-2019.yml +++ b/inventory/host_vars/sk-2019.yml @@ -4,7 +4,12 @@ install: credentials: "{{ vault_hroot_robot_account }}" server_name: 2019skillz disks: - layout: nvme_raid + primary: software-raid + raid: + level: 1 + members: + - /dev/nvme0n1 + - /dev/nvme1n1 root_lvm_size: 20G network: {} diff --git a/inventory/host_vars/sk-2019vm.yml b/inventory/host_vars/sk-2019vm.yml index 0c990b74..e989d37e 100644 --- a/inventory/host_vars/sk-2019vm.yml +++ b/inventory/host_vars/sk-2019vm.yml @@ -4,7 +4,12 @@ install: credentials: "{{ vault_hroot_robot_account }}" server_name: "{{ host_name }}" disks: - layout: nvme_raid + primary: software-raid + raid: + level: 1 + members: + - /dev/nvme0n1 + - /dev/nvme1n1 root_lvm_size: 10G network: diff --git a/inventory/host_vars/sk-cloudia/vars.yml b/inventory/host_vars/sk-cloudia/vars.yml index d7a2474e..f8167017 100644 --- a/inventory/host_vars/sk-cloudia/vars.yml +++ b/inventory/host_vars/sk-cloudia/vars.yml @@ -4,7 +4,12 @@ install: credentials: "{{ vault_hroot_robot_account }}" server_name: "{{ host_name }}" disks: - layout: nvme_raid + primary: software-raid + raid: + level: 1 + members: + - /dev/nvme0n1 + - /dev/nvme1n1 root_lvm_size: 15G network: {} diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index 8e285363..c61dc4e1 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -11,6 +11,10 @@ install: type: zfs name: root size: 10g + sdb: + type: zfs + name: root2 + size: 10g interfaces: - bridge: br-public name: primary0 diff --git a/inventory/host_vars/sk-tomnext.yml b/inventory/host_vars/sk-tomnext.yml index eca2de34..3702bd54 100644 --- a/inventory/host_vars/sk-tomnext.yml +++ b/inventory/host_vars/sk-tomnext.yml @@ -4,7 +4,12 @@ install: credentials: "{{ vault_hroot_robot_account }}" server_name: "{{ host_name }}" disks: - layout: nvme_raid + primary: software-raid + raid: + level: 1 + members: + - /dev/nvme0n1 + - /dev/nvme1n1 root_lvm_size: 10G network: diff --git a/roles/cloud/install/templates/hetzner_installimage.conf.j2 b/roles/cloud/install/templates/hetzner_installimage.conf.j2 index 0881b110..ed22f286 100644 --- a/roles/cloud/install/templates/hetzner_installimage.conf.j2 +++ b/roles/cloud/install/templates/hetzner_installimage.conf.j2 @@ -1,15 +1,13 @@ HOSTNAME {{ host_name }}{% if host_domain %}.{{ host_domain }}{% endif %}{{ '' }} {% if cloud_provider == "hroot" %} -{% if install_cooked.disks.layout == "nvme_raid" %} -DRIVE1 /dev/nvme0n1 -DRIVE2 /dev/nvme1n1 +{% if install_cooked.disks.primary == "software-raid" %} +{% for raid_member in install_cooked.disks.raid.members %} +DRIVE{{ loop.index }} {{ raid_member }} +{% endfor %} SWRAID 1 -SWRAIDLEVEL 1 -{% elif install_cooked.disks.layout == "sata_raid" %} -DRIVE1 /dev/sda -DRIVE2 /dev/sdb -SWRAID 1 -SWRAIDLEVEL 1 +SWRAIDLEVEL {{ install_cooked.disks.raid.level }} +{% else %} +DRIVE1 {{ install_cooked.disks.primary }} {% endif %} {% elif cloud_provider == "hcloud" %} DRIVE1 /dev/sda -- cgit v1.2.3 From c750374c93682f18b4e91dec3c88dfdd1a8af3e2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 29 Jun 2020 01:28:43 +0200 Subject: simplified partman early command --- inventory/host_vars/sk-testvm.yml | 9 +++++-- roles/installer/debian/preseed/tasks/main.yml | 2 +- .../debian/preseed/templates/partman_config.j2 | 28 ++++++++++++---------- .../preseed/templates/partman_early-command.sh.j2 | 17 +++++++------ roles/vm/define/templates/libvirt-domain.xml.j2 | 2 +- 5 files changed, 33 insertions(+), 25 deletions(-) (limited to 'inventory') diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index c61dc4e1..63538708 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -5,11 +5,16 @@ install: numcpu: 1 autostart: False disks: - primary: /dev/sda + primary: software-raid + raid: + level: 1 + members: + - /dev/sda + - /dev/sdb scsi: sda: type: zfs - name: root + name: root1 size: 10g sdb: type: zfs diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml index 53e9d225..599d9ddb 100644 --- a/roles/installer/debian/preseed/tasks/main.yml +++ b/roles/installer/debian/preseed/tasks/main.yml @@ -10,7 +10,7 @@ src: "preseed_{{ hostvars[install_hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" dest: "{{ preseed_tmpdir }}/preseed.cfg" -- name: Generate partman early-command +- name: Generate partmam early-command script template: src: "partman_early-command.sh.j2" dest: "{{ preseed_tmpdir }}/partman_early-command.sh" diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2 index ebaf180e..2d125b50 100644 --- a/roles/installer/debian/preseed/templates/partman_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -1,3 +1,4 @@ +{# https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks #} d-i partman/early_command string /partman_early-command.sh d-i partman/confirm boolean true @@ -9,11 +10,6 @@ d-i partman-lvm/device_remove_lvm boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true -{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} -d-i partman-auto/method string raid -{% else %} -d-i partman-auto/method string lvm -{% endif %} d-i partman-auto/purge_lvm_from_device boolean true d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} d-i partman-auto-lvm/guided_size string max @@ -28,35 +24,44 @@ d-i partman/choose_label string dos d-i partman/default_label string dos {% endif %} + +{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} +d-i partman-auto/method string raid +{% else %} +d-i partman-auto/method string lvm +{% endif %} + d-i partman-auto/choose_recipe select ansible d-i partman-auto/expert_recipe string \ ansible :: \ {% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ + $primary{ } $bootable{ } \ method{ efi } format{ } \ . \ {% endif %} {% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} 256 10000 256 raid \ - $lvmignore{ } $primary{ } method{ raid } \ + $lvmignore{ } $primary{ } $bootable{ } \ + method{ raid } \ . \ 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } method{ raid } \ + $lvmignore{ } $primary{ } \ + method{ raid } \ . \ {% endif %} 1000 10000 -1 ext4 \ $defaultignore{ } $primary{ } $bootable{ } \ method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ . \ - 2560 10000 2560 ext4 \ + 2048 10000 2560 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . \ - 1280 10000 1280 ext4 \ + 1024 10000 1280 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ @@ -86,6 +91,5 @@ d-i partman/choose_partition select finish ## boot devices are configured by partman/early_command -d-i grub-installer/bootdev seen true d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false +d-i grub-installer/with_other_os boolean true diff --git a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 index 08d3806d..9c720e92 100644 --- a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -4,30 +4,29 @@ umount -l /media || true {% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} -raid_disks="$(readlink -f {{ install_cooked.disks.raid.members | join(' ') }} | xargs)" -raid_config="{{ install_cooked.disks.raid.level }} {{ install_cooked.disks.raid.members | length }} 0" +disks="{% for disk in hostvars[install_hostname].install_cooked.disks.raid.members %}$(readlink -f {{ disk }}) {% endfor %}" raid_members_boot="" raid_members_lvm="" -for disk in $raid_disks; do +for disk in $disks; do [ -n "$raid_members_boot" ] && raid_members_boot="$raid_members_boot#" [ -n "$raid_members_lvm" ] && raid_members_lvm="$raid_members_lvm#" if echo "$disk" | grep -Eq "/dev/(s|v)d[a-z]"; then raid_members_boot="$raid_members_boot$disk"1 - raid_members_lvm="$raid_members_lvm$disk"1 + raid_members_lvm="$raid_members_lvm$disk"2 else raid_members_boot="$raid_members_boot$disk"p1 - raid_members_lvm="$raid_members_lvm$disk"p1 + raid_members_lvm="$raid_members_lvm$disk"p2 fi done +raid_config="{{ hostvars[install_hostname].install_cooked.disks.raid.level }} {{ hostvars[install_hostname].install_cooked.disks.raid.members | length }} 0" debconf-set partman-auto-raid/recipe "$raid_config ext4 /boot $raid_members_boot . $raid_config lvm - $raid_members_lvm ." -debconf-set partman-auto/disk "$raid_disks" -debconf-set grub-installer/bootdev "$raid_disks" {% else %} -debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})" -debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})" +disks="$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})" {% endif %} +debconf-set partman-auto/disk "$disks" +debconf-set grub-installer/bootdev "$disks" ## https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks . /usr/share/debconf/confmodule diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index af9fbf52..be2fd8b4 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -9,7 +9,7 @@ {% if install_distro == 'debian' or install_distro == 'ubuntu' %} {{ installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}/linux {{ preseed_tmpdir }}/initrd.preseed.gz - console=ttyS0,115200n8 + console=ttyS0,115200n8 DEBCONF_DEBUG=5 {% elif install_distro == 'openbsd' %} -- cgit v1.2.3 From 7a846cdbcf6a66cc0cc529613272b74579a517dc Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 29 Jun 2020 22:46:07 +0200 Subject: minor improvment for vm resource config --- inventory/host_vars/ch-gw-lan.yml | 4 ++-- inventory/host_vars/ch-hroottest-obsd.yml | 4 ++-- inventory/host_vars/ch-hroottest-vm1.yml | 4 ++-- inventory/host_vars/ch-jump.yml | 4 ++-- inventory/host_vars/ch-k8s-m0.yml | 4 ++-- inventory/host_vars/ch-k8s-m1.yml | 4 ++-- inventory/host_vars/ch-k8s-m2.yml | 4 ++-- inventory/host_vars/ch-k8s-w0.yml | 4 ++-- inventory/host_vars/ch-k8s-w1.yml | 4 ++-- inventory/host_vars/ch-keyserver.yml | 4 ++-- inventory/host_vars/ch-mimas.yml | 4 ++-- inventory/host_vars/ch-nic.yml | 4 ++-- inventory/host_vars/ch-router-obsd.yml | 4 ++-- inventory/host_vars/ch-testvm.yml | 4 ++-- inventory/host_vars/ele-gwhetzner.yml | 4 ++-- inventory/host_vars/ele-mur.yml | 4 ++-- inventory/host_vars/emc-master.yml | 4 ++-- inventory/host_vars/lw-master.yml | 4 ++-- inventory/host_vars/r3-vex2.yml | 4 ++-- inventory/host_vars/sk-testvm.yml | 4 ++-- inventory/host_vars/sk-tomnext-hp.yml | 4 ++-- inventory/host_vars/sk-tomnext-nc.yml | 4 ++-- inventory/host_vars/sk-torrent.yml | 4 ++-- roles/vm/define/templates/libvirt-domain.xml.j2 | 6 +++--- 24 files changed, 49 insertions(+), 49 deletions(-) (limited to 'inventory') diff --git a/inventory/host_vars/ch-gw-lan.yml b/inventory/host_vars/ch-gw-lan.yml index 35f98291..be092c15 100644 --- a/inventory/host_vars/ch-gw-lan.yml +++ b/inventory/host_vars/ch-gw-lan.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 512 - numcpu: 2 + memory: 512M + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-hroottest-obsd.yml b/inventory/host_vars/ch-hroottest-obsd.yml index f7d5cba7..96ec2fe2 100644 --- a/inventory/host_vars/ch-hroottest-obsd.yml +++ b/inventory/host_vars/ch-hroottest-obsd.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 1024 - numcpu: 1 + memory: 1G + numcpus: 1 autostart: True disks: primary: /dev/vda diff --git a/inventory/host_vars/ch-hroottest-vm1.yml b/inventory/host_vars/ch-hroottest-vm1.yml index 4f9e7e82..a7f45252 100644 --- a/inventory/host_vars/ch-hroottest-vm1.yml +++ b/inventory/host_vars/ch-hroottest-vm1.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 4096 - numcpu: 4 + memory: 4G + numcpus: 4 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-jump.yml b/inventory/host_vars/ch-jump.yml index 954819ba..e61cad17 100644 --- a/inventory/host_vars/ch-jump.yml +++ b/inventory/host_vars/ch-jump.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 768 - numcpu: 2 + memory: 768M + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-k8s-m0.yml b/inventory/host_vars/ch-k8s-m0.yml index dc42824f..7d81b792 100644 --- a/inventory/host_vars/ch-k8s-m0.yml +++ b/inventory/host_vars/ch-k8s-m0.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 4096 - numcpu: 2 + memory: 4G + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-k8s-m1.yml b/inventory/host_vars/ch-k8s-m1.yml index dc42824f..7d81b792 100644 --- a/inventory/host_vars/ch-k8s-m1.yml +++ b/inventory/host_vars/ch-k8s-m1.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 4096 - numcpu: 2 + memory: 4G + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-k8s-m2.yml b/inventory/host_vars/ch-k8s-m2.yml index da9fbe18..6de6fbfb 100644 --- a/inventory/host_vars/ch-k8s-m2.yml +++ b/inventory/host_vars/ch-k8s-m2.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 4096 - numcpu: 2 + memory: 4G + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-k8s-w0.yml b/inventory/host_vars/ch-k8s-w0.yml index 979efc24..51095a86 100644 --- a/inventory/host_vars/ch-k8s-w0.yml +++ b/inventory/host_vars/ch-k8s-w0.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 4096 - numcpu: 4 + memory: 4G + numcpus: 4 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-k8s-w1.yml b/inventory/host_vars/ch-k8s-w1.yml index 979efc24..51095a86 100644 --- a/inventory/host_vars/ch-k8s-w1.yml +++ b/inventory/host_vars/ch-k8s-w1.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 4096 - numcpu: 4 + memory: 4G + numcpus: 4 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-keyserver.yml b/inventory/host_vars/ch-keyserver.yml index 60ab034b..131da209 100644 --- a/inventory/host_vars/ch-keyserver.yml +++ b/inventory/host_vars/ch-keyserver.yml @@ -3,8 +3,8 @@ apt_repo_provider: ffgraz install: vm: - mem: 2048 - numcpu: 2 + memory: 2G + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-mimas.yml b/inventory/host_vars/ch-mimas.yml index dfec3866..38422a30 100644 --- a/inventory/host_vars/ch-mimas.yml +++ b/inventory/host_vars/ch-mimas.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 2048 - numcpu: 4 + memory: 2G + numcpus: 4 autostart: True disks: primary: /dev/vda diff --git a/inventory/host_vars/ch-nic.yml b/inventory/host_vars/ch-nic.yml index d26b1c40..60c68f57 100644 --- a/inventory/host_vars/ch-nic.yml +++ b/inventory/host_vars/ch-nic.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 768 - numcpu: 2 + memory: 768M + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-router-obsd.yml b/inventory/host_vars/ch-router-obsd.yml index 71137da1..74ecb75b 100644 --- a/inventory/host_vars/ch-router-obsd.yml +++ b/inventory/host_vars/ch-router-obsd.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 512 - numcpu: 1 + memory: 512M + numcpus: 1 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/ch-testvm.yml b/inventory/host_vars/ch-testvm.yml index 5b5e465e..7f74a891 100644 --- a/inventory/host_vars/ch-testvm.yml +++ b/inventory/host_vars/ch-testvm.yml @@ -3,8 +3,8 @@ apt_repo_provider: ffgraz install: vm: - mem: 1024 - numcpu: 1 + memory: 1G + numcpus: 1 autostart: False disks: primary: /dev/sda diff --git a/inventory/host_vars/ele-gwhetzner.yml b/inventory/host_vars/ele-gwhetzner.yml index d349ddcc..3be84fd7 100644 --- a/inventory/host_vars/ele-gwhetzner.yml +++ b/inventory/host_vars/ele-gwhetzner.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 1024 - numcpu: 1 + memory: 1G + numcpus: 1 autostart: False disks: primary: /dev/sda diff --git a/inventory/host_vars/ele-mur.yml b/inventory/host_vars/ele-mur.yml index b7d4d38e..3ee20fa4 100644 --- a/inventory/host_vars/ele-mur.yml +++ b/inventory/host_vars/ele-mur.yml @@ -7,8 +7,8 @@ apt_repo_provider: ffgraz install: vm: - mem: 1024 - numcpu: 1 + memory: 1G + numcpus: 1 autostart: False disks: primary: /dev/sda diff --git a/inventory/host_vars/emc-master.yml b/inventory/host_vars/emc-master.yml index 8005b9d9..dcf51a45 100644 --- a/inventory/host_vars/emc-master.yml +++ b/inventory/host_vars/emc-master.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 10240 - numcpu: 6 + memory: 10G + numcpus: 6 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/lw-master.yml b/inventory/host_vars/lw-master.yml index 8005b9d9..dcf51a45 100644 --- a/inventory/host_vars/lw-master.yml +++ b/inventory/host_vars/lw-master.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 10240 - numcpu: 6 + memory: 10G + numcpus: 6 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/r3-vex2.yml b/inventory/host_vars/r3-vex2.yml index d5471743..bf602568 100644 --- a/inventory/host_vars/r3-vex2.yml +++ b/inventory/host_vars/r3-vex2.yml @@ -3,8 +3,8 @@ apt_repo_provider: ffgraz install: vm: - mem: 2048 - numcpu: 2 + memory: 2G + numcpus: 2 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index 63538708..cad79e49 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 1024 - numcpu: 1 + memory: 1G + numcpus: 1 autostart: False disks: primary: software-raid diff --git a/inventory/host_vars/sk-tomnext-hp.yml b/inventory/host_vars/sk-tomnext-hp.yml index 2db59ed3..8975e5a3 100644 --- a/inventory/host_vars/sk-tomnext-hp.yml +++ b/inventory/host_vars/sk-tomnext-hp.yml @@ -6,8 +6,8 @@ ssh_users_root: install: vm: - mem: 8192 - numcpu: 4 + memory: 8G + numcpus: 4 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/sk-tomnext-nc.yml b/inventory/host_vars/sk-tomnext-nc.yml index 9b041b62..340795eb 100644 --- a/inventory/host_vars/sk-tomnext-nc.yml +++ b/inventory/host_vars/sk-tomnext-nc.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 16384 - numcpu: 8 + memory: 16G + numcpus: 8 autostart: True disks: primary: /dev/sda diff --git a/inventory/host_vars/sk-torrent.yml b/inventory/host_vars/sk-torrent.yml index 96ddfc4f..c8967dab 100644 --- a/inventory/host_vars/sk-torrent.yml +++ b/inventory/host_vars/sk-torrent.yml @@ -1,8 +1,8 @@ --- install: vm: - mem: 4096 - numcpu: 4 + memory: 4G + numcpus: 4 autostart: True disks: primary: /dev/sda diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index be2fd8b4..c4c9e52a 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -1,8 +1,8 @@ {{ install_hostname }} - {{ hostvars[install_hostname].install_cooked.vm.mem * 1024 }} - {{ hostvars[install_hostname].install_cooked.vm.mem * 1024 }} - {{ hostvars[install_hostname].install_cooked.vm.numcpu }} + {{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }} + {{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }} + {{ hostvars[install_hostname].install_cooked.vm.numcpus }} hvm {% if vm_define_installer %} -- cgit v1.2.3 From ee6843f01f382ac81a6ea48f7c3c074e56b5a996 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 2 Jul 2020 02:00:06 +0200 Subject: another attempt to tackle root_lvm_size issue --- inventory/host_vars/sk-testvm.yml | 26 ++++++------ .../debian/preseed/templates/partman_config.j2 | 48 ++++++++++++++++------ .../preseed/templates/partman_early-command.sh.j2 | 6 +++ 3 files changed, 55 insertions(+), 25 deletions(-) (limited to 'inventory') diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index cad79e49..73012082 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -5,21 +5,23 @@ install: numcpus: 1 autostart: False disks: - primary: software-raid - raid: - level: 1 - members: - - /dev/sda - - /dev/sdb + # primary: software-raid + # raid: + # level: 1 + # members: + # - /dev/sda + # - /dev/sdb + primary: /dev/sda + root_lvm_size: 10G scsi: sda: type: zfs - name: root1 - size: 10g - sdb: - type: zfs - name: root2 - size: 10g + name: root + size: 20g + # sdb: + # type: zfs + # name: root2 + # size: 10g interfaces: - bridge: br-public name: primary0 diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2 index 2d125b50..88b6a088 100644 --- a/roles/installer/debian/preseed/templates/partman_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -19,9 +19,17 @@ d-i partman-auto-lvm/no_boot boolean true d-i partman-efi/non_efi_system boolean true d-i partman/choose_label string gpt d-i partman/default_label string gpt +d-i partman-partitioning/choose_label string gpt +d-i partman-partitioning/default_label string gpt +d-i partman-basicfilesystems/choose_label string gpt +d-i partman-basicfilesystems/default_label string gpt {% else %} -d-i partman/choose_label string dos -d-i partman/default_label string dos +d-i partman/choose_label string msdos +d-i partman/default_label string msdos +d-i partman-partitioning/choose_label string msdos +d-i partman-partitioning/default_label string msdos +d-i partman-basicfilesystems/choose_label string msdos +d-i partman-basicfilesystems/default_label string msdos {% endif %} @@ -31,44 +39,56 @@ d-i partman-auto/method string raid d-i partman-auto/method string lvm {% endif %} -d-i partman-auto/choose_recipe select ansible d-i partman-auto/expert_recipe string \ ansible :: \ {% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ + 128 128 128 fat16 \ $primary{ } $bootable{ } \ method{ efi } format{ } \ . \ {% endif %} {% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} - 256 10000 256 raid \ + 256 256 256 raid \ $lvmignore{ } $primary{ } $bootable{ } \ method{ raid } \ . \ - 1000 10000 -1 raid \ + 10240 10340 -1 raid \ $lvmignore{ } $primary{ } \ method{ raid } \ . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ +{% else %} +{% if 'root_lvm_size' in hostvars[install_hostname].install_cooked.disks and hostvars[install_hostname].install_cooked.disks.root_lvm_size != 'all' %} +{% set root_lvm_size = ((hostvars[install_hostname].install_cooked.disks.root_lvm_size | human_to_bytes) / (1024*1024)) | int %} + {{ root_lvm_size }} {{ root_lvm_size }} {{ root_lvm_size }} lvm \ + $defaultignore{ } $primary{ } \ method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ . \ - 2048 10000 2560 ext4 \ + 8 108 -1 ext4 \ + $defaultignore{ } $primary{ } \ + method{ unused } \ + . \ +{% else %} + 5120 5120 5120 lvm \ + $defaultignore{ } $primary{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ +{% endif %} +{% endif %} + 2560 2560 2560 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . \ - 1024 10000 1280 ext4 \ + 1280 1280 1280 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /var } \ . \ - 768 10000 768 ext4 \ + 768 768 768 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ @@ -78,13 +98,15 @@ d-i partman-auto/expert_recipe string options/noatime{ noatime } \ options/noexec{ noexec } \ . \ - 16 20000 -1 ext4 \ + 8 108 -1 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ lv_name{ dummy } \ + method{ unused } \ . + d-i partman-basicfilesystems/no_swap true d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish diff --git a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 index 9c720e92..6187fbea 100644 --- a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -31,3 +31,9 @@ debconf-set grub-installer/bootdev "$disks" ## https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks . /usr/share/debconf/confmodule db_fset grub-installer/bootdev seen true + + +## wipe existing partition tables, 1M should be enough to get rid of them +for disk in $disks; do + dd if=/dev/zero "of=$disk" bs=32768 count=32 +done -- cgit v1.2.3 From 972a2ec5dbc6da4b8ee36079220c1dba8696f593 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 3 Jul 2020 02:00:29 +0200 Subject: use new preseed config in some hosts --- inventory/host_vars/ch-oulu.yml | 9 ++- inventory/host_vars/ele-calypso.yml | 11 +++- inventory/host_vars/sk-testvm.yml | 13 +--- .../debian/preseed/templates/partman_ws_config.j2 | 72 --------------------- .../templates/preseed_xubuntu-focal-desktop.cfg.j2 | 73 +++++++++++++++++++++- 5 files changed, 88 insertions(+), 90 deletions(-) delete mode 100644 roles/installer/debian/preseed/templates/partman_ws_config.j2 (limited to 'inventory') diff --git a/inventory/host_vars/ch-oulu.yml b/inventory/host_vars/ch-oulu.yml index b5b86138..d0d035d2 100644 --- a/inventory/host_vars/ch-oulu.yml +++ b/inventory/host_vars/ch-oulu.yml @@ -2,8 +2,13 @@ install: efi: true disks: - primary: /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800161Z - # primary: /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800191M + root_lvm_size: 15G + primary: software-raid + raid: + level: 1 + members: + - /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800161Z + - /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800191M network: nameservers: diff --git a/inventory/host_vars/ele-calypso.yml b/inventory/host_vars/ele-calypso.yml index 865bcebb..ab8fca7c 100644 --- a/inventory/host_vars/ele-calypso.yml +++ b/inventory/host_vars/ele-calypso.yml @@ -1,7 +1,12 @@ --- -preseed_template_name: "debian-buster-with-raid" - -install: {} +install: + disks: + primary: software-raid + raid: + level: 1 + members: + - /dev/sda + - /dev/sdb network: nameservers: "{{ network_zones.lan.dns }}" diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index 73012082..86c00c1f 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -5,23 +5,12 @@ install: numcpus: 1 autostart: False disks: - # primary: software-raid - # raid: - # level: 1 - # members: - # - /dev/sda - # - /dev/sdb primary: /dev/sda - root_lvm_size: 10G scsi: sda: type: zfs name: root - size: 20g - # sdb: - # type: zfs - # name: root2 - # size: 10g + size: 10g interfaces: - bridge: br-public name: primary0 diff --git a/roles/installer/debian/preseed/templates/partman_ws_config.j2 b/roles/installer/debian/preseed/templates/partman_ws_config.j2 deleted file mode 100644 index 54fe94f1..00000000 --- a/roles/installer/debian/preseed/templates/partman_ws_config.j2 +++ /dev/null @@ -1,72 +0,0 @@ -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-md/confirm boolean true -d-i partman-md/confirm_nooverwrite boolean true -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max -d-i partman-auto-lvm/no_boot boolean true - -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ - . \ - 15360 10000 20480 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 20480 10000 40960 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /home } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish - - -## boot devices are configured by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev seen true -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false diff --git a/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 index 4927e00b..eeda9943 100644 --- a/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 @@ -57,7 +57,78 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -{% include 'partman_ws_config.j2' %} +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-md/confirm boolean true +d-i partman-md/confirm_nooverwrite boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +d-i partman-auto/method string lvm +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} +d-i partman-auto-lvm/guided_size string max +d-i partman-auto-lvm/no_boot boolean true + +{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} +d-i partman-efi/non_efi_system boolean true +d-i partman/choose_label string gpt +d-i partman/default_label string gpt +{% endif %} +d-i partman-auto/expert_recipe string \ + boot-root :: \ +{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} + 100 100 128 fat16 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ efi } format{ } \ + . \ +{% endif %} + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ + 15360 10000 20480 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 768 10000 768 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 20480 10000 40960 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /home } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish + + +## boot devices are configured by partman/early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev seen true +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false d-i base-installer/install-recommends boolean false -- cgit v1.2.3