From 17077868e615fa7115abdb03a5af4662ab0a3679 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 23 Apr 2020 01:24:38 +0200 Subject: refactor all install roles ans playbooks to work with new variable install_hostname --- chaos-at-home/cloud-install.yml | 2 +- chaos-at-home/usb-install.yml | 2 +- chaos-at-home/vm-install.yml | 2 +- common/cloud-install.yml | 10 +- common/usb-install.yml | 8 +- common/vm-install.yml | 24 ++--- configure-info-beamer.sh | 2 +- dan/cloud-install.yml | 2 +- dan/info-beamer.yml | 2 +- dan/usb-install.yml | 2 +- dan/vm-install.yml | 2 +- install.sh | 2 +- .../cloud/install/templates/hetzner_postinst.sh.j2 | 4 +- roles/installer/debian/preseed/tasks/main.yml | 4 +- .../preseed_debian-buster-with-raid.cfg.j2 | 102 ++++++++++---------- .../preseed/templates/preseed_debian-buster.cfg.j2 | 106 ++++++++++----------- .../preseed/templates/preseed_debian-jessie.cfg.j2 | 102 ++++++++++---------- .../templates/preseed_debian-stretch.cfg.j2 | 106 ++++++++++----------- .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 106 ++++++++++----------- .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 106 ++++++++++----------- .../preseed_xubuntu-eoan-desktop-with-raid.cfg.j2 | 102 ++++++++++---------- .../openbsd/autoinstall/defaults/main.yml | 2 +- .../autoinstall/templates/auto_install.conf.j2 | 16 ++-- .../openbsd/autoinstall/templates/install.site.j2 | 6 +- roles/vm/define/defaults/main.yml | 2 +- roles/vm/define/tasks/main.yml | 20 ++-- roles/vm/define/templates/libvirt-domain.xml.j2 | 22 ++--- roles/vm/install/tasks/main.yml | 12 +-- spreadspace/cloud-install.yml | 2 +- spreadspace/usb-install.yml | 2 +- spreadspace/vm-install.yml | 2 +- 31 files changed, 443 insertions(+), 441 deletions(-) diff --git a/chaos-at-home/cloud-install.yml b/chaos-at-home/cloud-install.yml index 9b5bbee9..167cf458 100644 --- a/chaos-at-home/cloud-install.yml +++ b/chaos-at-home/cloud-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/chaos-at-home/usb-install.yml b/chaos-at-home/usb-install.yml index b7a1c8be..ab455ff7 100644 --- a/chaos-at-home/usb-install.yml +++ b/chaos-at-home/usb-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/chaos-at-home/vm-install.yml b/chaos-at-home/vm-install.yml index 99d1558d..405e14db 100644 --- a/chaos-at-home/vm-install.yml +++ b/chaos-at-home/vm-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/common/cloud-install.yml b/common/cloud-install.yml index e80bfed0..57ebc9e6 100644 --- a/common/cloud-install.yml +++ b/common/cloud-install.yml @@ -1,12 +1,12 @@ --- - name: basic installation - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no roles: - role: cloud/install - name: wait for newly installed machine to start up - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: ## TODO: find a better way to fetch host key of new VMs @@ -22,17 +22,17 @@ ansible_ssh_extra_args: "" - name: run post install roles - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" pre_tasks: - name: make sure to update cached facts setup: roles: - role: cloud/post-install -- import_playbook: "../{{ hostenv }}/{{ hostname }}.yml" +- import_playbook: "../{{ install_environment }}/{{ hostvars[install_hostname].install_playbook | default(install_hostname) }}.yml" - name: reboot and wait for machine come back - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no roles: - role: reboot-and-wait diff --git a/common/usb-install.yml b/common/usb-install.yml index db9faf7e..33f488eb 100644 --- a/common/usb-install.yml +++ b/common/usb-install.yml @@ -1,6 +1,6 @@ --- - name: fetch debian installer and bake initrd - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" connection: local gather_facts: no @@ -12,7 +12,7 @@ pre_tasks: - set_fact: - artifacts_dir: "{{ global_artifacts_dir }}/{{ hostname }}" + artifacts_dir: "{{ global_artifacts_dir }}/{{ install_hostname }}" installer_path: "{{ global_cache_dir }}/debian-installer" - file: @@ -44,7 +44,7 @@ dest: "{{ usbdrive_path }}/syslinux.cfg" content: | DEFAULT linux - SAY SYSLINUX booting an automated installer for {{ hostname }}... + SAY SYSLINUX booting an automated installer for {{ install_hostname }}... LABEL linux KERNEL linux INITRD initrd.preseed.gz @@ -60,7 +60,7 @@ dest: "{{ usbdrive_path }}/EFI/boot/syslinux.cfg" content: | DEFAULT linux - SAY SYSLINUX booting an automated installer for {{ hostname }}... + SAY SYSLINUX booting an automated installer for {{ install_hostname }}... LABEL linux KERNEL ../../linux INITRD ../../initrd.preseed.gz diff --git a/common/vm-install.yml b/common/vm-install.yml index cb3b86f0..c3e7a25c 100644 --- a/common/vm-install.yml +++ b/common/vm-install.yml @@ -1,17 +1,11 @@ --- - name: preperations and sanity checks - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - - name: create temporary host group for vm host - add_host: - name: "{{ vm_host }}" - inventory_dir: "{{ inventory_dir }}" - group: _vmhost_ - - name: check if the installee belongs to the kvmguests group fail: - msg: "the host '{{ hostname }}' does not belong to the group 'kvmguests'" + msg: "the host '{{ install_hostname }}' does not belong to the group 'kvmguests'" when: - "'kvmguests' not in group_names" @@ -23,6 +17,12 @@ # TODO: add some more sanity checks + - name: create temporary host group for vm host + add_host: + name: "{{ vm_host }}" + inventory_dir: "{{ inventory_dir }}" + group: _vmhost_ + - name: basic installation hosts: _vmhost_ @@ -30,7 +30,7 @@ - role: vm/install - name: wait for new vm to start up - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: ## TODO: find a better way to fetch host key of new VMs @@ -46,7 +46,7 @@ ansible_ssh_extra_args: "" - name: apply basic VM configuration roles - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" pre_tasks: - name: make sure to update cached facts setup: @@ -58,10 +58,10 @@ - role: vm/guest when: install_distro in ['debian', 'ubuntu'] -- import_playbook: "../{{ hostenv }}/{{ hostname }}.yml" +- import_playbook: "../{{ install_environment }}/{{ hostvars[install_hostname].install_playbook | default(install_hostname) }}.yml" - name: reboot and wait for VM come back - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no roles: - role: reboot-and-wait diff --git a/configure-info-beamer.sh b/configure-info-beamer.sh index 2d290872..a4afeecb 100755 --- a/configure-info-beamer.sh +++ b/configure-info-beamer.sh @@ -16,4 +16,4 @@ echo "configuring $name in environment '$env_group'" echo "" echo "######## running the info-beamer playbook ########" -exec ansible-playbook -e "hostname=$name" $@ "$env_group/info-beamer.yml" +exec ansible-playbook -e "infobeamer_hostname=$name" $@ "$env_group/info-beamer.yml" diff --git a/dan/cloud-install.yml b/dan/cloud-install.yml index 9b5bbee9..167cf458 100644 --- a/dan/cloud-install.yml +++ b/dan/cloud-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/dan/info-beamer.yml b/dan/info-beamer.yml index 272a2783..6160e9f2 100644 --- a/dan/info-beamer.yml +++ b/dan/info-beamer.yml @@ -1,6 +1,6 @@ --- - name: configure info-beamer - hosts: "{{ hostname }}" + hosts: "{{ infobeamer_hostname }}" connection: local gather_facts: no diff --git a/dan/usb-install.yml b/dan/usb-install.yml index b7a1c8be..ab455ff7 100644 --- a/dan/usb-install.yml +++ b/dan/usb-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/dan/vm-install.yml b/dan/vm-install.yml index 99d1558d..405e14db 100644 --- a/dan/vm-install.yml +++ b/dan/vm-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/install.sh b/install.sh index 764f23bc..e329856b 100755 --- a/install.sh +++ b/install.sh @@ -26,4 +26,4 @@ rm -f ".cache/facts/$name" echo "" echo "######## running the install playbook ########" -exec ansible-playbook -e "hostname=$name" -e "install_distro=$distro" -e "install_codename=$codename" -e "hostenv=$env_group" $@ "$env_group/$(basename "$0" .sh).yml" +exec ansible-playbook -e "install_hostname=$name" -e "install_distro=$distro" -e "install_codename=$codename" -e "install_environment=$env_group" $@ "$env_group/$(basename "$0" .sh).yml" diff --git a/roles/cloud/install/templates/hetzner_postinst.sh.j2 b/roles/cloud/install/templates/hetzner_postinst.sh.j2 index ac357db6..39a3fd7d 100644 --- a/roles/cloud/install/templates/hetzner_postinst.sh.j2 +++ b/roles/cloud/install/templates/hetzner_postinst.sh.j2 @@ -16,8 +16,8 @@ mkdir -p -m 0700 /target/root/.ssh cat < /root/.ssh/authorized_keys {{ ssh_keys_root | join('\n') }} EOK -{% if hostvars[hostname].ansible_port is defined %} -sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config +{% if hostvars[install_hostname].ansible_port is defined %} +sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config {% endif %} {# this is actually only needed on ubuntu bionic and beyond but should not hurt on other installations either #} diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml index b1b5d275..aa71335e 100644 --- a/roles/installer/debian/preseed/tasks/main.yml +++ b/roles/installer/debian/preseed/tasks/main.yml @@ -2,12 +2,12 @@ - name: Copy initramfs into position copy: remote_src: yes - src: "{{ installer_path | mandatory }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/initrd.gz" + src: "{{ installer_path | mandatory }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}/initrd.gz" dest: "{{ preseed_tmpdir }}/initrd.preseed.gz" - name: Generate preseed file template: - src: "preseed_{{ hostvars[hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" + src: "preseed_{{ hostvars[install_hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" dest: "{{ preseed_tmpdir }}/preseed.cfg" - name: Generate authorized_keys file diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 index b4a7e846..0e34c84e 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 @@ -9,29 +9,29 @@ d-i keyboard-configuration/xkb-keymap select us d-i hw-detect/load_firmware boolean false -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false {% else %} d-i netcfg/disable_dhcp boolean true d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true {% endif %} -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].debian }} d-i mirror/http/directory string /debian d-i mirror/http/proxy string @@ -49,7 +49,7 @@ d-i partman-auto/disk string /dev/sda /dev/sdb d-i partman-auto/method string raid d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +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-lvm/device_remove_lvm boolean true @@ -62,41 +62,41 @@ d-i partman-lvm/confirm_nooverwrite boolean true d-i partman/choose_label string dos d-i partman/default_label string dos d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 256 512 256 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 15360 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 768 10000 768 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 20480 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /home } \ - . \ - 16 20000 -1 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ +d-i partman-auto/expert_recipe string \ + boot-root :: \ + 256 512 256 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ + 1000 10000 -1 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ + 15360 10000 20480 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 768 10000 768 ext4 \ + $defaultignore{ } $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 20480 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /home } \ + . \ + 16 20000 -1 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ . d-i partman-auto-raid/recipe string \ @@ -115,7 +115,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].debian }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt @@ -131,7 +131,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ {% if preseed_force_net_ifnames_policy is defined %} @@ -141,8 +141,8 @@ d-i preseed/late_command string \ in-target bash -c "update-initramfs -u"; \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% if hostvars[install_hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 index 9952fa0a..abb5eb25 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -9,29 +9,29 @@ d-i keyboard-configuration/xkb-keymap select us d-i hw-detect/load_firmware boolean false -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false {% else %} d-i netcfg/disable_dhcp boolean true d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true {% endif %} -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].debian }} d-i mirror/http/directory string /debian d-i mirror/http/proxy string @@ -47,8 +47,8 @@ d-i clock-setup/ntp boolean false d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + 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 grub-installer/choose_bootdev string manual @@ -56,7 +56,7 @@ d-i grub-installer/bootdev seen 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[hostname].host_name }} +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-lvm/device_remove_lvm boolean true @@ -65,46 +65,46 @@ d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +{% 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[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ +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[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 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 } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ . d-i partman-auto-lvm/no_boot boolean true @@ -116,7 +116,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].debian }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt @@ -130,7 +130,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ {% if preseed_force_net_ifnames_policy is defined %} @@ -140,8 +140,8 @@ d-i preseed/late_command string \ in-target bash -c "update-initramfs -u"; \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% if hostvars[install_hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 index 4519d910..35bb28b4 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -9,24 +9,24 @@ d-i keyboard-configuration/xkb-keymap select us d-i hw-detect/load_firmware boolean false -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false {% else %} d-i netcfg/disable_dhcp boolean true d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true {% endif %} -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} d-i netcfg/wireless_wep string @@ -47,8 +47,8 @@ d-i clock-setup/ntp boolean false d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + 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 grub-installer/choose_bootdev string manual @@ -56,7 +56,7 @@ d-i grub-installer/bootdev seen 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[hostname].host_name }} +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-lvm/device_remove_lvm boolean true @@ -65,46 +65,46 @@ d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +{% 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[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ +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[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 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 } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ . d-i partman-auto-lvm/no_boot boolean true @@ -130,7 +130,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ {% if preseed_force_net_ifnames_policy is defined %} @@ -140,8 +140,8 @@ d-i preseed/late_command string \ in-target bash -c "update-initramfs -u"; \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% if hostvars[install_hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 index 8969fa7c..ecedbab6 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -9,29 +9,29 @@ d-i keyboard-configuration/xkb-keymap select us d-i hw-detect/load_firmware boolean false -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false {% else %} d-i netcfg/disable_dhcp boolean true d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true {% endif %} -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].debian }} d-i mirror/http/directory string /debian d-i mirror/http/proxy string @@ -47,8 +47,8 @@ d-i clock-setup/ntp boolean false d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + 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 grub-installer/choose_bootdev string manual @@ -56,7 +56,7 @@ d-i grub-installer/bootdev seen 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[hostname].host_name }} +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-lvm/device_remove_lvm boolean true @@ -65,46 +65,46 @@ d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +{% 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[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ +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[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 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 } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ . d-i partman-auto-lvm/no_boot boolean true @@ -116,7 +116,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].debian }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt @@ -130,7 +130,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ {% if preseed_force_net_ifnames_policy is defined %} @@ -140,8 +140,8 @@ d-i preseed/late_command string \ in-target bash -c "update-initramfs -u"; \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% if hostvars[install_hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index a2fffd11..769dc3ad 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -16,29 +16,29 @@ d-i hw-detect/load_firmware boolean false {% if preseed_no_netplan %} d-i netcfg/do_not_use_netplan boolean true {% endif %} -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false {% else %} d-i netcfg/disable_dhcp boolean true d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true {% endif %} -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].ubuntu }} d-i mirror/http/directory string /ubuntu d-i mirror/http/proxy string @@ -55,8 +55,8 @@ d-i clock-setup/ntp boolean false d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + 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 grub-installer/choose_bootdev string manual @@ -64,7 +64,7 @@ d-i grub-installer/bootdev seen 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[hostname].host_name }} +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-lvm/device_remove_lvm boolean true @@ -73,46 +73,46 @@ d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +{% 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[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ +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[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 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 } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ . d-i partman-auto-lvm/no_boot boolean true @@ -124,7 +124,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].ubuntu }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt ifupdown @@ -139,7 +139,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ in-target bash -c "swapoff -a; sed -e '/^\/swapfile/d' -i /etc/fstab; rm -f /swapfile"; \ in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ {% if preseed_no_netplan %} @@ -153,8 +153,8 @@ d-i preseed/late_command string \ in-target bash -c "update-initramfs -u"; \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% if hostvars[install_hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index 0b3d3698..95199656 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -13,29 +13,29 @@ d-i keyboard-configuration/layoutcode string us d-i hw-detect/load_firmware boolean false -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false {% else %} d-i netcfg/disable_dhcp boolean true d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true {% endif %} -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].ubuntu }} d-i mirror/http/directory string /ubuntu d-i mirror/http/proxy string @@ -52,8 +52,8 @@ d-i clock-setup/ntp boolean false d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + 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 grub-installer/choose_bootdev string manual @@ -61,7 +61,7 @@ d-i grub-installer/bootdev seen 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[hostname].host_name }} +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-lvm/device_remove_lvm boolean true @@ -70,46 +70,46 @@ d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +{% 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[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ +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[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 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 } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ . d-i partman-auto-lvm/no_boot boolean true @@ -121,7 +121,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].ubuntu }} tasksel tasksel/first multiselect d-i pkgsel/include string openssh-server python python-apt @@ -136,7 +136,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ {% if preseed_force_net_ifnames_policy is defined %} @@ -146,8 +146,8 @@ d-i preseed/late_command string \ in-target bash -c "update-initramfs -u"; \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% if hostvars[install_hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_xubuntu-eoan-desktop-with-raid.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_xubuntu-eoan-desktop-with-raid.cfg.j2 index 262f4ed0..b0d5a18d 100644 --- a/roles/installer/debian/preseed/templates/preseed_xubuntu-eoan-desktop-with-raid.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_xubuntu-eoan-desktop-with-raid.cfg.j2 @@ -19,29 +19,29 @@ d-i hw-detect/load_firmware boolean false {% if preseed_no_netplan %} d-i netcfg/do_not_use_netplan boolean true {% endif %} -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false {% else %} d-i netcfg/disable_dhcp boolean true d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true {% endif %} -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} +d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} d-i netcfg/wireless_wep string d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].ubuntu }} d-i mirror/http/directory string /ubuntu d-i mirror/http/proxy string @@ -60,7 +60,7 @@ d-i partman-auto/disk string /dev/sda /dev/sdb d-i partman-auto/method string raid d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +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-lvm/device_remove_lvm boolean true @@ -73,41 +73,41 @@ d-i partman-lvm/confirm_nooverwrite boolean true d-i partman/choose_label string dos d-i partman/default_label string dos d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 256 512 256 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 15360 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 768 10000 768 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 20480 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /home } \ - . \ - 16 20000 -1 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ +d-i partman-auto/expert_recipe string \ + boot-root :: \ + 256 512 256 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ + 1000 10000 -1 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ + 15360 10000 20480 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 768 10000 768 ext4 \ + $defaultignore{ } $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 20480 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /home } \ + . \ + 16 20000 -1 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ . d-i partman-auto-raid/recipe string \ @@ -126,7 +126,7 @@ d-i partman/confirm_nooverwrite boolean true d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[install_hostname].apt_repo_provider | default('default'))].ubuntu }} tasksel tasksel/first multiselect xubuntu-desktop d-i pkgsel/include string openssh-server python python-apt ifupdown @@ -145,7 +145,7 @@ d-i finish-install/reboot_in_progress note d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ in-target bash -c "swapoff -a; sed -e '/^\/swapfile/d' -i /etc/fstab; rm -f /swapfile"; \ in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ {% if preseed_no_netplan %} @@ -159,8 +159,8 @@ d-i preseed/late_command string \ in-target bash -c "update-initramfs -u"; \ {% endif %} in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% if hostvars[install_hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ {% endif %} mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/openbsd/autoinstall/defaults/main.yml b/roles/installer/openbsd/autoinstall/defaults/main.yml index cdea194e..27f7221a 100644 --- a/roles/installer/openbsd/autoinstall/defaults/main.yml +++ b/roles/installer/openbsd/autoinstall/defaults/main.yml @@ -1,7 +1,7 @@ --- # obsd_autoinstall_tmpdir: -obsd_autoinstall_arch: "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" +obsd_autoinstall_arch: "{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}" obsd_autoinstall_version: "{{ install_codename }}" obsd_autoinstall_version_short: "{{ obsd_autoinstall_version | replace('.', '') }}" diff --git a/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 index 18e85a80..4220be38 100644 --- a/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 +++ b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 @@ -1,15 +1,15 @@ -System hostname = {{ hostvars[hostname].host_name }} +System hostname = {{ hostvars[install_hostname].host_name }} -Which network interface do you wish to configure = {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +Which network interface do you wish to configure = {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} IPv4 address = dhcp {% else %} -IPv4 address = {{ hostvars[hostname].network_cooked.primary.ip }} -Netmask = {{ hostvars[hostname].network_cooked.primary.mask }} -Default IPv4 route = {{ hostvars[hostname].network_cooked.primary.gateway }} +IPv4 address = {{ hostvars[install_hostname].network_cooked.primary.ip }} +Netmask = {{ hostvars[install_hostname].network_cooked.primary.mask }} +Default IPv4 route = {{ hostvars[install_hostname].network_cooked.primary.gateway }} {% endif %} -DNS domain name = {{ hostvars[hostname].network_cooked.domain }} -DNS nameservers = {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +DNS domain name = {{ hostvars[install_hostname].network_cooked.domain }} +DNS nameservers = {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} {% if obsd_autoinstall_serial_device is defined %} Change the default console to {{ obsd_autoinstall_serial_device }} = yes diff --git a/roles/installer/openbsd/autoinstall/templates/install.site.j2 b/roles/installer/openbsd/autoinstall/templates/install.site.j2 index 82928daa..974b516a 100644 --- a/roles/installer/openbsd/autoinstall/templates/install.site.j2 +++ b/roles/installer/openbsd/autoinstall/templates/install.site.j2 @@ -8,9 +8,9 @@ cat < /root/.ssh/authorized_keys {{ ssh_keys_root | join('\n') }} EOF -{% if hostvars[hostname].ansible_port is defined %} -echo "Setting SSH port to {{ hostvars[hostname].ansible_port }}" -sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config +{% if hostvars[install_hostname].ansible_port is defined %} +echo "Setting SSH port to {{ hostvars[install_hostname].ansible_port }}" +sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config {% endif %} echo "Installing python" diff --git a/roles/vm/define/defaults/main.yml b/roles/vm/define/defaults/main.yml index dbde0d8c..29884a9b 100644 --- a/roles/vm/define/defaults/main.yml +++ b/roles/vm/define/defaults/main.yml @@ -1,5 +1,5 @@ --- -vm_define_autostart: "{{ not vm_define_installer and hostvars[hostname].install_cooked.autostart | default(False) }}" +vm_define_autostart: "{{ not vm_define_installer and hostvars[install_hostname].install_cooked.autostart | default(False) }}" vm_define_start: yes vm_define_installer: no diff --git a/roles/vm/define/tasks/main.yml b/roles/vm/define/tasks/main.yml index 4c2b99e1..d0790628 100644 --- a/roles/vm/define/tasks/main.yml +++ b/roles/vm/define/tasks/main.yml @@ -1,26 +1,27 @@ --- - name: check if vm already exists virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" command: info register: vmhost_info -- when: hostname in vmhost_info +- name: remove old vm + when: install_hostname in vmhost_info block: - name: destroy exisiting vm virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" state: destroyed - name: wait for vm to be destroyed wait_for_virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" states: shutdown,crashed timeout: 5 - name: undefining exisiting vm virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" command: undefine - name: define vm @@ -28,21 +29,22 @@ command: define xml: "{{ lookup('template', 'libvirt-domain.xml.j2') }}" -- when: vm_define_start | bool +- name: start new vm + when: vm_define_start | bool block: - name: start vm virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" state: running - name: wait for VM to start wait_for_virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" states: running timeout: 10 - name: mark vm as autostarted virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" autostart: "{{ vm_define_autostart }}" command: info ## virt module needs either command or state diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index 780d1bae..3465cec0 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -1,13 +1,13 @@ - {{ hostname }} - {{ hostvars[hostname].install_cooked.mem * 1024 }} - {{ hostvars[hostname].install_cooked.mem * 1024 }} - {{ hostvars[hostname].install_cooked.numcpu }} + {{ install_hostname }} + {{ hostvars[install_hostname].install_cooked.mem * 1024 }} + {{ hostvars[install_hostname].install_cooked.mem * 1024 }} + {{ hostvars[install_hostname].install_cooked.numcpu }} hvm {% if vm_define_installer %} {% if install_distro == 'debian' or install_distro == 'ubuntu' %} - {{ installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/linux + {{ installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}/linux {{ preseed_tmpdir }}/initrd.preseed.gz console=ttyS0,115200n8 @@ -50,8 +50,8 @@ {% endif %} -{% if 'virtio' in hostvars[hostname].install_cooked.disks %} -{% for device, src in hostvars[hostname].install_cooked.disks.virtio.items() %} +{% if 'virtio' in hostvars[install_hostname].install_cooked.disks %} +{% for device, src in hostvars[install_hostname].install_cooked.disks.virtio.items() %} {% if src.type == 'lvm' %} @@ -64,9 +64,9 @@ {% endfor %} {% endif %} -{% if 'scsi' in hostvars[hostname].install_cooked.disks %} +{% if 'scsi' in hostvars[install_hostname].install_cooked.disks %} -{% for device, src in hostvars[hostname].install_cooked.disks.scsi.items() %} +{% for device, src in hostvars[install_hostname].install_cooked.disks.scsi.items() %} {% if src.type == 'lvm' %} @@ -79,8 +79,8 @@ {% endfor %} {% endif %} -{% if hostvars[hostname].install_cooked.interfaces %} -{% for if in hostvars[hostname].install_cooked.interfaces %} +{% if hostvars[install_hostname].install_cooked.interfaces %} +{% for if in hostvars[install_hostname].install_cooked.interfaces %} {% if 'mac' in if %} diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml index 20484401..50772e53 100644 --- a/roles/vm/install/tasks/main.yml +++ b/roles/vm/install/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: create lvm-based disks for vm - loop: "{{ hostvars[hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[hostname].install_cooked.disks.scsi | default({})) | dict2items }}" + loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items }}" loop_control: label: "{% if item.value.type == 'lvm' %}{{ item.value.vg }} / {{ item.value.lv }} ({{ item.value.size }}){% else %}unused{% endif %}" when: item.value.type == 'lvm' @@ -11,7 +11,7 @@ state: present - name: create zfs-based disks for vm - loop: "{{ hostvars[hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[hostname].install_cooked.disks.scsi | default({})) | dict2items }}" + loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items }}" loop_control: label: "{% if item.value.type == 'zfs' %}{{ item.value.pool }} / {{ item.value.name }} ({{ item.value.size }}){% else %}unused{% endif %}" when: item.value.type == 'zfs' @@ -30,7 +30,7 @@ - when: install_distro in ['debian', 'ubuntu'] vars: - ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" + ssh_keys_root: "{{ hostvars[install_hostname].ssh_keys_root }}" preseed_tmpdir: "{{ tmpdir.path }}" preseed_force_net_ifnames_policy: path preseed_no_netplan: yes @@ -40,7 +40,7 @@ - when: install_distro in ['openbsd'] vars: - ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" + ssh_keys_root: "{{ hostvars[install_hostname].ssh_keys_root }}" obsd_autoinstall_tmpdir: "{{ tmpdir.path }}" obsd_autoinstall_serial_device: com0 install_interface: vio0 @@ -62,7 +62,7 @@ preseed_tmpdir: "{{ tmpdir.path }}" - debug: - msg: "you can check on the status of the installer running this command 'virsh console {{ hostname }}' on host {{ inventory_hostname }}." + msg: "you can check on the status of the installer running this command 'virsh console {{ install_hostname }}' on host {{ inventory_hostname }}." - when: installer_manual_steps_msg is defined pause: @@ -75,7 +75,7 @@ - name: wait for installer to finish or crash wait_for_virt: - name: "{{ hostname }}" + name: "{{ install_hostname }}" states: shutdown,crashed timeout: 1800 register: installer_result diff --git a/spreadspace/cloud-install.yml b/spreadspace/cloud-install.yml index 9b5bbee9..167cf458 100644 --- a/spreadspace/cloud-install.yml +++ b/spreadspace/cloud-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/spreadspace/usb-install.yml b/spreadspace/usb-install.yml index b7a1c8be..ab455ff7 100644 --- a/spreadspace/usb-install.yml +++ b/spreadspace/usb-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: diff --git a/spreadspace/vm-install.yml b/spreadspace/vm-install.yml index 99d1558d..405e14db 100644 --- a/spreadspace/vm-install.yml +++ b/spreadspace/vm-install.yml @@ -1,6 +1,6 @@ --- - name: setup variables - hosts: "{{ hostname }}" + hosts: "{{ install_hostname }}" gather_facts: no tasks: - set_fact: -- cgit v1.2.3