summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-11-21 03:42:54 +0100
committerChristian Pointner <equinox@spreadspace.org>2020-11-21 03:42:54 +0100
commit8828d4e11c28da88d65e45014431361aabb0c3d5 (patch)
tree759456a48196e108cf35bab4f1c6a774e8c20170
parentadd some vmhost test machines (diff)
use delegation for vm/guest install and define
-rw-r--r--chaos-at-home/vm-install.yml9
-rw-r--r--common/vm-install.yml9
-rw-r--r--dan/vm-install.yml9
-rw-r--r--roles/cloud/install/templates/hetzner_postinst.sh.j24
-rw-r--r--roles/installer/debian/iso/templates/grub.cfg.j22
-rw-r--r--roles/installer/debian/iso/templates/isolinux.cfg.j22
-rw-r--r--roles/installer/debian/preseed/tasks/main.yml4
-rw-r--r--roles/installer/debian/preseed/templates/partman_config.j228
-rw-r--r--roles/installer/debian/preseed/templates/partman_early-command.sh.j210
-rw-r--r--roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j236
-rw-r--r--roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j236
-rw-r--r--roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j232
-rw-r--r--roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j236
-rw-r--r--roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j238
-rw-r--r--roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j238
-rw-r--r--roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j238
-rw-r--r--roles/installer/openbsd/autoinstall/templates/auto_install.conf.j218
-rw-r--r--roles/installer/openbsd/autoinstall/templates/install.site.j28
-rw-r--r--roles/installer/openbsd/fetch/vars/main.yml3
-rw-r--r--roles/vm/guest/define/defaults/main.yml2
-rw-r--r--roles/vm/guest/define/tasks/main.yml49
-rw-r--r--roles/vm/guest/define/templates/libvirt-domain.xml.j218
-rw-r--r--roles/vm/guest/install/tasks/installer-debian.yml8
-rw-r--r--roles/vm/guest/install/tasks/installer-openbsd.yml8
-rw-r--r--roles/vm/guest/install/tasks/main.yml97
-rw-r--r--spreadspace/vm-install.yml9
26 files changed, 271 insertions, 280 deletions
diff --git a/chaos-at-home/vm-install.yml b/chaos-at-home/vm-install.yml
index b6a69b67..7d8e7320 100644
--- a/chaos-at-home/vm-install.yml
+++ b/chaos-at-home/vm-install.yml
@@ -1,5 +1,5 @@
---
-- name: cook variables for guest
+- name: cook variables for host
hosts: "{{ install_hostname }}"
gather_facts: no
tasks:
@@ -8,11 +8,4 @@
network_cooked: "{{ network }}"
vm_host_cooked: "{{ vm_host }}"
-- name: cook variables for host
- hosts: "{{ hostvars[install_hostname].vm_host.name }}"
- gather_facts: no
- tasks:
- - set_fact:
- vm_host_cooked: "{{ vm_host }}"
-
- import_playbook: ../common/vm-install.yml
diff --git a/common/vm-install.yml b/common/vm-install.yml
index 5084ba0b..ce438905 100644
--- a/common/vm-install.yml
+++ b/common/vm-install.yml
@@ -17,15 +17,10 @@
# TODO: add some more sanity checks
- - name: create temporary host group for vm host
- add_host:
- name: "{{ vm_host_cooked.name }}"
- inventory_dir: "{{ inventory_dir }}"
- group: _vmhost_
-
- name: basic installation
- hosts: _vmhost_
+ hosts: "{{ install_hostname }}"
+ gather_facts: no
roles:
- role: vm/guest/install
diff --git a/dan/vm-install.yml b/dan/vm-install.yml
index b6a69b67..7d8e7320 100644
--- a/dan/vm-install.yml
+++ b/dan/vm-install.yml
@@ -1,5 +1,5 @@
---
-- name: cook variables for guest
+- name: cook variables for host
hosts: "{{ install_hostname }}"
gather_facts: no
tasks:
@@ -8,11 +8,4 @@
network_cooked: "{{ network }}"
vm_host_cooked: "{{ vm_host }}"
-- name: cook variables for host
- hosts: "{{ hostvars[install_hostname].vm_host.name }}"
- gather_facts: no
- tasks:
- - set_fact:
- vm_host_cooked: "{{ vm_host }}"
-
- import_playbook: ../common/vm-install.yml
diff --git a/roles/cloud/install/templates/hetzner_postinst.sh.j2 b/roles/cloud/install/templates/hetzner_postinst.sh.j2
index ad701364..8f923313 100644
--- a/roles/cloud/install/templates/hetzner_postinst.sh.j2
+++ b/roles/cloud/install/templates/hetzner_postinst.sh.j2
@@ -33,8 +33,8 @@ mkdir -p -m 0700 /target/root/.ssh
cat <<EOK > /root/.ssh/authorized_keys
{{ ssh_keys_root | join('\n') }}
EOK
-{% 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
+{% if ansible_port is defined %}
+sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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/iso/templates/grub.cfg.j2 b/roles/installer/debian/iso/templates/grub.cfg.j2
index 31ec5d8b..d13ca96d 100644
--- a/roles/installer/debian/iso/templates/grub.cfg.j2
+++ b/roles/installer/debian/iso/templates/grub.cfg.j2
@@ -15,6 +15,6 @@ set timeout=10
set default=0
menuentry "automated installer for {{ install_hostname }}" {
- linux /linux --- auto {{ (hostvars[install_hostname].install_cooked.kernel_cmdline | default([])) | join(' ') }}
+ linux /linux --- auto {{ (install_cooked.kernel_cmdline | default([])) | join(' ') }}
initrd /initrd.gz
}
diff --git a/roles/installer/debian/iso/templates/isolinux.cfg.j2 b/roles/installer/debian/iso/templates/isolinux.cfg.j2
index 0a6555c2..0fb43c25 100644
--- a/roles/installer/debian/iso/templates/isolinux.cfg.j2
+++ b/roles/installer/debian/iso/templates/isolinux.cfg.j2
@@ -12,4 +12,4 @@ SAY **
LABEL {{ install_hostname }}
KERNEL linux
INITRD initrd.gz
- APPEND auto fb=false {{ (hostvars[install_hostname].install_cooked.kernel_cmdline | default([])) | join(' ') }}
+ APPEND auto fb=false {{ (install_cooked.kernel_cmdline | default([])) | join(' ') }}
diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml
index 3c45001f..cec5474e 100644
--- a/roles/installer/debian/preseed/tasks/main.yml
+++ b/roles/installer/debian/preseed/tasks/main.yml
@@ -1,7 +1,7 @@
---
- name: Generate preseed file
template:
- src: "preseed_{{ hostvars[install_hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2"
+ src: "preseed_{{ preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2"
dest: "{{ preseed_tmpdir }}/preseed.cfg"
- name: Generate partmam early-command script
@@ -15,7 +15,7 @@
user: root
manage_dir: no
path: "{{ preseed_tmpdir }}/authorized_keys"
- key: "{{ hostvars[install_hostname].ssh_keys_root | join('\n') }}"
+ key: "{{ ssh_keys_root | join('\n') }}"
- name: force net interface name policy
when: preseed_force_net_ifnames_policy is defined
diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2
index 975c2fe5..9f8c7dcd 100644
--- a/roles/installer/debian/preseed/templates/partman_config.j2
+++ b/roles/installer/debian/preseed/templates/partman_config.j2
@@ -11,11 +11,11 @@ d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
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/new_vg_name string {{ 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)) %}
+{% if (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
@@ -32,30 +32,30 @@ d-i partman-basicfilesystems/choose_label string msdos
d-i partman-basicfilesystems/default_label string msdos
{% endif %}
-{% set system_lvm_size = hostvars[install_hostname].install_cooked.system_lvm.size | default(preseed_system_lvm_size_default) %}
-{% set system_lvm_volumes = hostvars[install_hostname].install_cooked.system_lvm.volumes | default(preseed_system_lvm_volumes_default) %}
+{% set system_lvm_size = install_cooked.system_lvm.size | default(preseed_system_lvm_size_default) %}
+{% set system_lvm_volumes = install_cooked.system_lvm.volumes | default(preseed_system_lvm_volumes_default) %}
{# on small disks this probably triggers: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896826 ... #}
-{# set system_lvm_reserve = hostvars[install_hostname].install_cooked.system_lvm.reserve | default(preseed_system_lvm_reserve_default) #}
+{# set system_lvm_reserve = install_cooked.system_lvm.reserve | default(preseed_system_lvm_reserve_default) #}
{# set system_lvm_pv_size_min_mb = (((system_lvm_volumes | map(attribute='size') | map('human_to_bytes') | sum) / (1024*1024)) | int) + (((system_lvm_reserve | human_to_bytes) / (1024*1024)) | int) #}
{# ... so let's go for a 1 MB minimum. #}
{% set system_lvm_pv_size_min_mb = 1 %}
-{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %}
+{% if 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/expert_recipe string \
ansible :: \
-{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %}
-{% set efi_esp_size_mb = (((hostvars[install_hostname].preseed_efi_esp_size | default(preseed_efi_esp_size)) | human_to_bytes) / (1024*1024)) | int %}
+{% if (install_cooked.efi | default(false)) %}
+{% set efi_esp_size_mb = (((preseed_efi_esp_size | default(preseed_efi_esp_size)) | human_to_bytes) / (1024*1024)) | int %}
{{ efi_esp_size_mb }} {{ efi_esp_size_mb }} {{ efi_esp_size_mb }} fat16 \
$primary{ } $bootable{ } \
method{ efi } format{ } \
. \
{% endif %}
-{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %}
-{% set swraid_boot_size_mb = (((hostvars[install_hostname].preseed_swraid_boot_size | default(preseed_swraid_boot_size)) | human_to_bytes) / (1024*1024)) | int %}
+{% if install_cooked.disks.primary == "software-raid" %}
+{% set swraid_boot_size_mb = (((preseed_swraid_boot_size | default(preseed_swraid_boot_size)) | human_to_bytes) / (1024*1024)) | int %}
{{ swraid_boot_size_mb }} {{ swraid_boot_size_mb }} {{ swraid_boot_size_mb }} raid \
$lvmignore{ } $primary{ } $bootable{ } \
method{ raid } \
@@ -82,7 +82,7 @@ d-i partman-auto/expert_recipe string
{% set system_lvm_size_mb = ((system_lvm_size | human_to_bytes) / (1024*1024)) | int %}
{{ system_lvm_size_mb }} {{ system_lvm_size_mb }} {{ system_lvm_size_mb }} lvm \
$defaultignore{ } $primary{ } \
- method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \
+ method{ lvm } vg_name{ {{ host_name }} } \
. \
1 101 -1 ext4 \
$defaultignore{ } $primary{ } \
@@ -91,7 +91,7 @@ d-i partman-auto/expert_recipe string
{% else %}
{{ system_lvm_pv_size_min_mb }} {{ system_lvm_pv_size_min_mb + 100 }} -1 lvm \
$defaultignore{ } $primary{ } \
- method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \
+ method{ lvm } vg_name{ {{ host_name }} } \
. \
{% endif %}
{% endif %}
@@ -99,7 +99,7 @@ d-i partman-auto/expert_recipe string
{% set volume_size = ((volume.size | human_to_bytes) / (1024*1024)) | int %}
{{ volume_size }} {{ volume_size }} {{ volume_size }} {{ volume.filesystem }} \
$defaultignore{ } $lvmok{ } \
- in_vg{ {{ hostvars[install_hostname].host_name }} } lv_name{ {{ volume.name }} } \
+ in_vg{ {{ host_name }} } lv_name{ {{ volume.name }} } \
method{ format } format{ } \
use_filesystem{ } filesystem{ {{ volume.filesystem }} } \
mountpoint{ {{ volume.mountpoint }} } \
@@ -111,7 +111,7 @@ d-i partman-auto/expert_recipe string
{% endfor %}
1 101 -1 ext4 \
$defaultignore{ } $lvmok{ } \
- in_vg{ {{ hostvars[install_hostname].host_name }} } lv_name{ dummy } \
+ in_vg{ {{ host_name }} } lv_name{ dummy } \
method{ unused } \
.
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 6ec77a36..c7ceb8c6 100644
--- a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2
+++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2
@@ -3,10 +3,10 @@
umount -l /media || true
-{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %}
-disks="{% for disk in hostvars[install_hostname].install_cooked.disks.raid.members %}$(readlink -f {{ disk }}) {% endfor %}"
+{% if install_cooked.disks.primary == "software-raid" %}
+disks="{% for disk in install_cooked.disks.raid.members %}$(readlink -f {{ disk }}) {% endfor %}"
-{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %}
+{% if (install_cooked.efi | default(false)) %}
idx=1
{% else %}
idx=0
@@ -24,11 +24,11 @@ for disk in $disks; do
raid_members_lvm="$raid_members_lvm$disk"p$((idx + 2))
fi
done
-raid_config="{{ hostvars[install_hostname].install_cooked.disks.raid.level }} {{ hostvars[install_hostname].install_cooked.disks.raid.members | length }} 0"
+raid_config="{{ install_cooked.disks.raid.level }} {{ 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 ."
{% else %}
-disks="$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"
+disks="$(readlink -f {{ install_cooked.disks.primary }})"
{% endif %}
debconf-set partman-auto/disk "$disks"
debconf-set grub-installer/bootdev "$disks"
diff --git a/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2
index 04ccfcb4..f1fa03ad 100644
--- a/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2
+++ b/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2
@@ -14,30 +14,30 @@ d-i keyboard-configuration/variantcode string {{ preseed_keyboard_variant }}
d-i hw-detect/load_firmware boolean false
-d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+d-i netcfg/choose_interface select {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
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[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-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/get_ipaddress string {{ network_cooked.primary.address | ipaddr('address') }}
+d-i netcfg/get_netmask string {{ network_cooked.primary.address | ipaddr('netmask') }}
+d-i netcfg/get_gateway string {{ network_cooked.primary.gateway }}
+d-i netcfg/get_nameservers string {{ network_cooked.nameservers | join(' ') }}
d-i netcfg/confirm_static boolean true
{% endif %}
-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/hostname string {{ host_name }}
+d-i netcfg/get_hostname string {{ host_name }}
+d-i netcfg/domain string {{ network_cooked.domain }}
+d-i netcfg/get_domain string {{ 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[install_hostname].apt_repo_provider].debian.host }}
-d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.path }}
+d-i mirror/http/hostname string {{ apt_repo_providers[apt_repo_provider].debian.host }}
+d-i mirror/http/directory string {{ apt_repo_providers[apt_repo_provider].debian.path }}
d-i mirror/http/proxy string
@@ -59,11 +59,11 @@ d-i base-installer/kernel/image string {{ preseed_kernel_image }}
{% endif %}
d-i base-installer/install-recommends boolean false
-d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.host }}
-d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.path }}
+d-i apt-setup/security_host string {{ apt_repo_providers[apt_repo_provider].debian_security.host }}
+d-i apt-setup/security_path string {{ apt_repo_providers[apt_repo_provider].debian_security.path }}
tasksel tasksel/first multiselect {{ preseed_install_tasks | join(', ') }}
-d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt
+d-i pkgsel/include string openssh-server {{ python_basename }} {{ python_basename }}-apt
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
@@ -71,7 +71,7 @@ d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
- lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \
+ lvremove -f {{ 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 %}
@@ -84,8 +84,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[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"; \
+{% if ansible_port is defined %}
+ in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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 77671947..bf312377 100644
--- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2
+++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2
@@ -14,30 +14,30 @@ d-i keyboard-configuration/variantcode string {{ preseed_keyboard_variant }}
d-i hw-detect/load_firmware boolean false
-d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+d-i netcfg/choose_interface select {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
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[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-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/get_ipaddress string {{ network_cooked.primary.address | ipaddr('address') }}
+d-i netcfg/get_netmask string {{ network_cooked.primary.address | ipaddr('netmask') }}
+d-i netcfg/get_gateway string {{ network_cooked.primary.gateway }}
+d-i netcfg/get_nameservers string {{ network_cooked.nameservers | join(' ') }}
d-i netcfg/confirm_static boolean true
{% endif %}
-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/hostname string {{ host_name }}
+d-i netcfg/get_hostname string {{ host_name }}
+d-i netcfg/domain string {{ network_cooked.domain }}
+d-i netcfg/get_domain string {{ 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[install_hostname].apt_repo_provider].debian.host }}
-d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.path }}
+d-i mirror/http/hostname string {{ apt_repo_providers[apt_repo_provider].debian.host }}
+d-i mirror/http/directory string {{ apt_repo_providers[apt_repo_provider].debian.path }}
d-i mirror/http/proxy string
@@ -59,11 +59,11 @@ d-i base-installer/kernel/image string {{ preseed_kernel_image }}
{% endif %}
d-i base-installer/install-recommends boolean false
-d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.host }}
-d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.path }}
+d-i apt-setup/security_host string {{ apt_repo_providers[apt_repo_provider].debian_security.host }}
+d-i apt-setup/security_path string {{ apt_repo_providers[apt_repo_provider].debian_security.path }}
tasksel tasksel/first multiselect {{ preseed_install_tasks | join(', ') }}
-d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt
+d-i pkgsel/include string openssh-server {{ python_basename }} {{ python_basename }}-apt
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
@@ -71,7 +71,7 @@ d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
- lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \
+ lvremove -f {{ 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 %}
@@ -84,8 +84,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[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"; \
+{% if ansible_port is defined %}
+ in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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 02379c16..b8d792c6 100644
--- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2
+++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2
@@ -14,30 +14,30 @@ d-i keyboard-configuration/variantcode string {{ preseed_keyboard_variant }}
d-i hw-detect/load_firmware boolean false
-d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+d-i netcfg/choose_interface select {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
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[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-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/get_ipaddress string {{ network_cooked.primary.address | ipaddr('address') }}
+d-i netcfg/get_netmask string {{ network_cooked.primary.address | ipaddr('netmask') }}
+d-i netcfg/get_gateway string {{ network_cooked.primary.gateway }}
+d-i netcfg/get_nameservers string {{ network_cooked.nameservers | join(' ') }}
d-i netcfg/confirm_static boolean true
{% endif %}
-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/hostname string {{ host_name }}
+d-i netcfg/get_hostname string {{ host_name }}
+d-i netcfg/domain string {{ network_cooked.domain }}
+d-i netcfg/get_domain string {{ 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[install_hostname].apt_repo_provider].debian.host }}
-d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.path }}
+d-i mirror/http/hostname string {{ apt_repo_providers[apt_repo_provider].debian.host }}
+d-i mirror/http/directory string {{ apt_repo_providers[apt_repo_provider].debian.path }}
d-i mirror/http/proxy string
@@ -63,7 +63,7 @@ d-i apt-setup/security_host string
#d-i apt-setup/security_host string
tasksel tasksel/first multiselect {{ preseed_install_tasks | join(', ') }}
-d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt
+d-i pkgsel/include string openssh-server {{ python_basename }} {{ python_basename }}-apt
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
@@ -71,7 +71,7 @@ d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
- lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \
+ lvremove -f {{ 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 %}
@@ -81,8 +81,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[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"; \
+{% if ansible_port is defined %}
+ in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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 01108f09..e6c3209c 100644
--- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2
+++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2
@@ -14,30 +14,30 @@ d-i keyboard-configuration/variantcode string {{ preseed_keyboard_variant }}
d-i hw-detect/load_firmware boolean false
-d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+d-i netcfg/choose_interface select {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
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[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-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/get_ipaddress string {{ network_cooked.primary.address | ipaddr('address') }}
+d-i netcfg/get_netmask string {{ network_cooked.primary.address | ipaddr('netmask') }}
+d-i netcfg/get_gateway string {{ network_cooked.primary.gateway }}
+d-i netcfg/get_nameservers string {{ network_cooked.nameservers | join(' ') }}
d-i netcfg/confirm_static boolean true
{% endif %}
-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/hostname string {{ host_name }}
+d-i netcfg/get_hostname string {{ host_name }}
+d-i netcfg/domain string {{ network_cooked.domain }}
+d-i netcfg/get_domain string {{ 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[install_hostname].apt_repo_provider].debian.host }}
-d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian.path }}
+d-i mirror/http/hostname string {{ apt_repo_providers[apt_repo_provider].debian.host }}
+d-i mirror/http/directory string {{ apt_repo_providers[apt_repo_provider].debian.path }}
d-i mirror/http/proxy string
@@ -59,11 +59,11 @@ d-i base-installer/kernel/image string {{ preseed_kernel_image }}
{% endif %}
d-i base-installer/install-recommends boolean false
-d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.host }}
-d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian_security.path }}
+d-i apt-setup/security_host string {{ apt_repo_providers[apt_repo_provider].debian_security.host }}
+d-i apt-setup/security_path string {{ apt_repo_providers[apt_repo_provider].debian_security.path }}
tasksel tasksel/first multiselect {{ preseed_install_tasks | join(', ') }}
-d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt
+d-i pkgsel/include string openssh-server {{ python_basename }} {{ python_basename }}-apt
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
@@ -71,7 +71,7 @@ d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
- lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \
+ lvremove -f {{ 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 %}
@@ -81,8 +81,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[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"; \
+{% if ansible_port is defined %}
+ in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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 503d09c4..b86cdc1b 100644
--- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2
+++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2
@@ -18,30 +18,30 @@ 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[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+d-i netcfg/choose_interface select {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
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[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-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/get_ipaddress string {{ network_cooked.primary.address | ipaddr('address') }}
+d-i netcfg/get_netmask string {{ network_cooked.primary.address | ipaddr('netmask') }}
+d-i netcfg/get_gateway string {{ network_cooked.primary.gateway }}
+d-i netcfg/get_nameservers string {{ network_cooked.nameservers | join(' ') }}
d-i netcfg/confirm_static boolean true
{% endif %}
-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/hostname string {{ host_name }}
+d-i netcfg/get_hostname string {{ host_name }}
+d-i netcfg/domain string {{ network_cooked.domain }}
+d-i netcfg/get_domain string {{ 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[install_hostname].apt_repo_provider].ubuntu.host }}
-d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }}
+d-i mirror/http/hostname string {{ apt_repo_providers[apt_repo_provider].ubuntu.host }}
+d-i mirror/http/directory string {{ apt_repo_providers[apt_repo_provider].ubuntu.path }}
d-i mirror/http/proxy string
@@ -70,14 +70,14 @@ d-i debian-installer/add-kernel-opts string nosplash
{% endif %}
d-i base-installer/install-recommends boolean false
-d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }}
-d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }}
-{% if hostvars[install_hostname].install_cooked.arch | default('amd64') == 'amd64' %}
+d-i apt-setup/security_host string {{ apt_repo_providers[apt_repo_provider].ubuntu.host }}
+d-i apt-setup/security_path string {{ apt_repo_providers[apt_repo_provider].ubuntu.path }}
+{% if install_cooked.arch | default('amd64') == 'amd64' %}
d-i apt-setup/multiarch string amd64
{% endif %}
tasksel tasksel/first multiselect {{ preseed_install_tasks | join(', ') }}
-d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt{% if preseed_no_netplan %} ifupdown{% endif %}{{ '' }}
+d-i pkgsel/include string openssh-server {{ python_basename }} {{ python_basename }}-apt{% if preseed_no_netplan %} ifupdown{% endif %}{{ '' }}
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
d-i pkgsel/update-policy select none
@@ -86,7 +86,7 @@ d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
- lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \
+ lvremove -f {{ 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"; \
in-target bash -c "env SUDO_FORCE_REMOVE=yes apt-get purge -y -q ubuntu-minimal sudo ubuntu-advantage-tools"; \
@@ -101,8 +101,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[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"; \
+{% if ansible_port is defined %}
+ in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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-focal.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2
index 64fad668..22845823 100644
--- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2
+++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2
@@ -18,30 +18,30 @@ 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[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+d-i netcfg/choose_interface select {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
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[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-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/get_ipaddress string {{ network_cooked.primary.address | ipaddr('address') }}
+d-i netcfg/get_netmask string {{ network_cooked.primary.address | ipaddr('netmask') }}
+d-i netcfg/get_gateway string {{ network_cooked.primary.gateway }}
+d-i netcfg/get_nameservers string {{ network_cooked.nameservers | join(' ') }}
d-i netcfg/confirm_static boolean true
{% endif %}
-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/hostname string {{ host_name }}
+d-i netcfg/get_hostname string {{ host_name }}
+d-i netcfg/domain string {{ network_cooked.domain }}
+d-i netcfg/get_domain string {{ 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[install_hostname].apt_repo_provider].ubuntu.host }}
-d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }}
+d-i mirror/http/hostname string {{ apt_repo_providers[apt_repo_provider].ubuntu.host }}
+d-i mirror/http/directory string {{ apt_repo_providers[apt_repo_provider].ubuntu.path }}
d-i mirror/http/proxy string
@@ -70,14 +70,14 @@ d-i debian-installer/add-kernel-opts string nosplash
{% endif %}
d-i base-installer/install-recommends boolean false
-d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }}
-d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }}
-{% if hostvars[install_hostname].install_cooked.arch | default('amd64') == 'amd64' %}
+d-i apt-setup/security_host string {{ apt_repo_providers[apt_repo_provider].ubuntu.host }}
+d-i apt-setup/security_path string {{ apt_repo_providers[apt_repo_provider].ubuntu.path }}
+{% if install_cooked.arch | default('amd64') == 'amd64' %}
d-i apt-setup/multiarch string amd64
{% endif %}
tasksel tasksel/first multiselect {{ preseed_install_tasks | join(', ') }}
-d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt{% if preseed_no_netplan %} ifupdown{% endif %}{{ '' }}
+d-i pkgsel/include string openssh-server {{ python_basename }} {{ python_basename }}-apt{% if preseed_no_netplan %} ifupdown{% endif %}{{ '' }}
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
d-i pkgsel/update-policy select none
@@ -86,7 +86,7 @@ d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
- lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \
+ lvremove -f {{ 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"; \
in-target bash -c "env SUDO_FORCE_REMOVE=yes apt-get purge -y -q ubuntu-minimal sudo ubuntu-advantage-tools"; \
@@ -104,8 +104,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[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"; \
+{% if ansible_port is defined %}
+ in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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 fbebcddf..e9ac5d8c 100644
--- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2
+++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2
@@ -15,30 +15,30 @@ d-i keyboard-configuration/variantcode string {{ preseed_keyboard_variant }}
d-i hw-detect/load_firmware boolean false
-d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+d-i netcfg/choose_interface select {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
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[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-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/get_ipaddress string {{ network_cooked.primary.address | ipaddr('address') }}
+d-i netcfg/get_netmask string {{ network_cooked.primary.address | ipaddr('netmask') }}
+d-i netcfg/get_gateway string {{ network_cooked.primary.gateway }}
+d-i netcfg/get_nameservers string {{ network_cooked.nameservers | join(' ') }}
d-i netcfg/confirm_static boolean true
{% endif %}
-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/hostname string {{ host_name }}
+d-i netcfg/get_hostname string {{ host_name }}
+d-i netcfg/domain string {{ network_cooked.domain }}
+d-i netcfg/get_domain string {{ 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[install_hostname].apt_repo_provider].ubuntu.host }}
-d-i mirror/http/directory string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }}
+d-i mirror/http/hostname string {{ apt_repo_providers[apt_repo_provider].ubuntu.host }}
+d-i mirror/http/directory string {{ apt_repo_providers[apt_repo_provider].ubuntu.path }}
d-i mirror/http/proxy string
@@ -67,14 +67,14 @@ d-i debian-installer/add-kernel-opts string nosplash
{% endif %}
d-i base-installer/install-recommends boolean false
-d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.host }}
-d-i apt-setup/security_path string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].ubuntu.path }}
-{% if hostvars[install_hostname].install_cooked.arch | default('amd64') == 'amd64' %}
+d-i apt-setup/security_host string {{ apt_repo_providers[apt_repo_provider].ubuntu.host }}
+d-i apt-setup/security_path string {{ apt_repo_providers[apt_repo_provider].ubuntu.path }}
+{% if install_cooked.arch | default('amd64') == 'amd64' %}
d-i apt-setup/multiarch string amd64
{% endif %}
tasksel tasksel/first multiselect {{ preseed_install_tasks | join(', ') }}
-d-i pkgsel/include string openssh-server {{ hostvars[install_hostname].python_basename }} {{ hostvars[install_hostname].python_basename }}-apt
+d-i pkgsel/include string openssh-server {{ python_basename }} {{ python_basename }}-apt
d-i pkgsel/upgrade select safe-upgrade
popularity-contest popularity-contest/participate boolean false
d-i pkgsel/update-policy select none
@@ -83,7 +83,7 @@ d-i finish-install/reboot_in_progress note
d-i preseed/late_command string \
- lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \
+ lvremove -f {{ host_name }}/dummy; \
in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \
in-target bash -c "env SUDO_FORCE_REMOVE=yes apt-get purge -y -q ubuntu-minimal sudo ubuntu-advantage-tools"; \
in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \
@@ -94,8 +94,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[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"; \
+{% if ansible_port is defined %}
+ in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ 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/templates/auto_install.conf.j2 b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2
index 6c23d753..4cfdbfa7 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[install_hostname].host_name }}
+System hostname = {{ host_name }}
-Which network interface do you wish to configure = {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.name) }}
-{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %}
+Which network interface do you wish to configure = {{ install_interface | default(network_cooked.primary.name) }}
+{% if (install_dhcp | default(false)) %}
IPv4 address = dhcp
{% else %}
-IPv4 address = {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('address') }}
-Netmask = {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }}
-Default IPv4 route = {{ hostvars[install_hostname].network_cooked.primary.gateway }}
+IPv4 address = {{ network_cooked.primary.address | ipaddr('address') }}
+Netmask = {{ network_cooked.primary.address | ipaddr('netmask') }}
+Default IPv4 route = {{ network_cooked.primary.gateway }}
{% endif %}
-DNS domain name = {{ hostvars[install_hostname].network_cooked.domain }}
-DNS nameservers = {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }}
+DNS domain name = {{ network_cooked.domain }}
+DNS nameservers = {{ network_cooked.nameservers | join(' ') }}
{% if obsd_autoinstall_serial_device is defined %}
Change the default console to {{ obsd_autoinstall_serial_device }} = yes
@@ -17,7 +17,7 @@ Which speed should {{ obsd_autoinstall_serial_device }} use = {{ obsd_autoinstal
{% endif %}
{# we will install only one key for now, install.site will install the rest #}
-Public ssh key for root account = {{ hostvars[install_hostname].ssh_keys_root[0] }}
+Public ssh key for root account = {{ ssh_keys_root[0] }}
Password for root = this-very-very-secure-password-will-be-overwritten-by-install.site
Setup a user = no
Start sshd(8) by default = yes
diff --git a/roles/installer/openbsd/autoinstall/templates/install.site.j2 b/roles/installer/openbsd/autoinstall/templates/install.site.j2
index 32b33ea9..ddf53d46 100644
--- a/roles/installer/openbsd/autoinstall/templates/install.site.j2
+++ b/roles/installer/openbsd/autoinstall/templates/install.site.j2
@@ -5,12 +5,12 @@ usermod -p "$(openssl rand -base64 24 | encrypt)" root
echo "Installing SSH keys for root"
cat <<EOF > /root/.ssh/authorized_keys
-{{ hostvars[install_hostname].ssh_keys_root | join('\n') }}
+{{ ssh_keys_root | join('\n') }}
EOF
-{% 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
+{% if ansible_port is defined %}
+echo "Setting SSH port to {{ ansible_port }}"
+sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config
{% endif %}
echo "Installing python"
diff --git a/roles/installer/openbsd/fetch/vars/main.yml b/roles/installer/openbsd/fetch/vars/main.yml
index dad9f064..b694a42e 100644
--- a/roles/installer/openbsd/fetch/vars/main.yml
+++ b/roles/installer/openbsd/fetch/vars/main.yml
@@ -5,3 +5,6 @@ openbsd_installer_signing_keys:
"6.7": |
untrusted comment: openbsd 6.7 base public key
RWRmkIA877Io3oCILSZoJGhAswifJbFK4r18ICoia+3c0PfwANueolNj
+ "6.8": |
+ untrusted comment: openbsd 6.8 base public key
+ RWQZj25CSG5R2oLo5735Hh6C48kkjFsj5rJDjW+fGZwyY+BkD5/zps8f
diff --git a/roles/vm/guest/define/defaults/main.yml b/roles/vm/guest/define/defaults/main.yml
index f0bcc4fd..05aeaab6 100644
--- a/roles/vm/guest/define/defaults/main.yml
+++ b/roles/vm/guest/define/defaults/main.yml
@@ -1,5 +1,5 @@
---
-vm_define_autostart: "{{ not vm_define_installer and hostvars[install_hostname].install_cooked.vm.autostart | default(False) }}"
+vm_define_autostart: "{{ not vm_define_installer and install_cooked.vm.autostart | default(False) }}"
vm_define_start: yes
vm_define_installer: no
diff --git a/roles/vm/guest/define/tasks/main.yml b/roles/vm/guest/define/tasks/main.yml
index d0790628..65094bbb 100644
--- a/roles/vm/guest/define/tasks/main.yml
+++ b/roles/vm/guest/define/tasks/main.yml
@@ -1,5 +1,6 @@
---
- name: check if vm already exists
+ delegate_to: "{{ vm_host_cooked.name }}"
virt:
name: "{{ install_hostname }}"
command: info
@@ -7,43 +8,47 @@
- name: remove old vm
when: install_hostname in vmhost_info
+ delegate_to: "{{ vm_host_cooked.name }}"
block:
- - name: destroy exisiting vm
- virt:
- name: "{{ install_hostname }}"
- state: destroyed
+ - name: destroy exisiting vm
+ virt:
+ name: "{{ install_hostname }}"
+ state: destroyed
- - name: wait for vm to be destroyed
- wait_for_virt:
- name: "{{ install_hostname }}"
- states: shutdown,crashed
- timeout: 5
+ - name: wait for vm to be destroyed
+ wait_for_virt:
+ name: "{{ install_hostname }}"
+ states: shutdown,crashed
+ timeout: 5
- - name: undefining exisiting vm
- virt:
- name: "{{ install_hostname }}"
- command: undefine
+ - name: undefining exisiting vm
+ virt:
+ name: "{{ install_hostname }}"
+ command: undefine
- name: define vm
+ delegate_to: "{{ vm_host_cooked.name }}"
virt:
command: define
xml: "{{ lookup('template', 'libvirt-domain.xml.j2') }}"
- name: start new vm
when: vm_define_start | bool
+ delegate_to: "{{ vm_host_cooked.name }}"
block:
- - name: start vm
- virt:
- name: "{{ install_hostname }}"
- state: running
+ - name: start vm
+ virt:
+ name: "{{ install_hostname }}"
+ state: running
- - name: wait for VM to start
- wait_for_virt:
- name: "{{ install_hostname }}"
- states: running
- timeout: 10
+ - name: wait for VM to start
+ wait_for_virt:
+ name: "{{ install_hostname }}"
+ states: running
+ timeout: 10
- name: mark vm as autostarted
+ delegate_to: "{{ vm_host_cooked.name }}"
virt:
name: "{{ install_hostname }}"
autostart: "{{ vm_define_autostart }}"
diff --git a/roles/vm/guest/define/templates/libvirt-domain.xml.j2 b/roles/vm/guest/define/templates/libvirt-domain.xml.j2
index 05ad6750..ce8a48d4 100644
--- a/roles/vm/guest/define/templates/libvirt-domain.xml.j2
+++ b/roles/vm/guest/define/templates/libvirt-domain.xml.j2
@@ -1,8 +1,8 @@
<domain type='kvm'>
<name>{{ install_hostname }}</name>
- <memory>{{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</memory>
- <currentMemory>{{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</currentMemory>
- <vcpu>{{ hostvars[install_hostname].install_cooked.vm.numcpus }}</vcpu>
+ <memory>{{ ((install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</memory>
+ <currentMemory>{{ ((install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</currentMemory>
+ <vcpu>{{ install_cooked.vm.numcpus }}</vcpu>
<os>
<type arch='x86_64' machine='pc-0.12'>hvm</type>
{% if vm_define_installer %}
@@ -50,8 +50,8 @@
</disk>
{% endif %}
-{% if 'virtio' in hostvars[install_hostname].install_cooked.disks %}
-{% for device, src in hostvars[install_hostname].install_cooked.disks.virtio.items() %}
+{% if 'virtio' in install_cooked.disks %}
+{% for device, src in install_cooked.disks.virtio.items() %}
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' discard='unmap'/>
{% if src.type == 'lvm' %}
@@ -64,9 +64,9 @@
{% endfor %}
{% endif %}
-{% if 'scsi' in hostvars[install_hostname].install_cooked.disks %}
+{% if 'scsi' in install_cooked.disks %}
<controller type='scsi' index='0' model='virtio-scsi'/>
-{% for device, src in hostvars[install_hostname].install_cooked.disks.scsi.items() %}
+{% for device, src in install_cooked.disks.scsi.items() %}
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' discard='unmap'/>
{% if src.type == 'lvm' %}
@@ -79,8 +79,8 @@
{% endfor %}
{% endif %}
-{% if hostvars[install_hostname].install_cooked.interfaces %}
-{% for if in hostvars[install_hostname].install_cooked.interfaces %}
+{% if install_cooked.interfaces %}
+{% for if in install_cooked.interfaces %}
<interface type='bridge'>
{% if 'mac' in if %}
<mac address='{{ if.mac }}'/>
diff --git a/roles/vm/guest/install/tasks/installer-debian.yml b/roles/vm/guest/install/tasks/installer-debian.yml
index b0bc6e9e..9e484b88 100644
--- a/roles/vm/guest/install/tasks/installer-debian.yml
+++ b/roles/vm/guest/install/tasks/installer-debian.yml
@@ -1,17 +1,19 @@
---
+## this file is sourced using import_task and all task are therefore delegated to the vm-host
- name: fetch debian installer files
vars:
+ installer_base_path: "{{ hostvars[vm_host_cooked.name].installer_base_path }}"
debian_installer_distro: "{{ install_distro }}"
debian_installer_codename: "{{ install_codename }}"
- debian_installer_arch: "{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}"
+ debian_installer_arch: "{{ install_cooked.arch | default('amd64') }}"
debian_installer_variant: netboot
import_role:
name: installer/debian/fetch
- name: copy the installer files to the temporary installer directory
loop:
- - linux
- - initrd.gz
+ - linux
+ - initrd.gz
copy:
remote_src: yes
src: "{{ debian_installer_target_dir }}/{{ item }}"
diff --git a/roles/vm/guest/install/tasks/installer-openbsd.yml b/roles/vm/guest/install/tasks/installer-openbsd.yml
index cc59ee36..903e94e2 100644
--- a/roles/vm/guest/install/tasks/installer-openbsd.yml
+++ b/roles/vm/guest/install/tasks/installer-openbsd.yml
@@ -1,17 +1,19 @@
---
+## this file is sourced using import_task and all task are therefore delegated to the vm-host
- name: fetch openbsd installer files
vars:
+ installer_base_path: "{{ hostvars[vm_host_cooked.name].installer_base_path }}"
openbsd_installer_version: "{{ install_codename }}"
- openbsd_installer_arch: "{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}"
+ openbsd_installer_arch: "{{ install_cooked.arch | default('amd64') }}"
import_role:
name: installer/openbsd/fetch
- name: generate host specific autoinstall iso
vars:
- obsd_autoinstall_orig_iso: "{{ installer_base_path }}/openbsd-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}/install{{ openbsd_installer_version_short }}.iso"
+ obsd_autoinstall_orig_iso: "{{ hostvars[vm_host_cooked.name].installer_base_path }}/openbsd-{{ install_codename }}/{{ install_cooked.arch | default('amd64') }}/install{{ openbsd_installer_version_short }}.iso"
obsd_autoinstall_tmpdir: "{{ tmpdir.path }}"
obsd_autoinstall_version: "{{ install_codename }}"
- obsd_autoinstall_arch: "{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}"
+ obsd_autoinstall_arch: "{{ install_cooked.arch | default('amd64') }}"
obsd_autoinstall_serial_device: com0
install_interface: vio0
import_role:
diff --git a/roles/vm/guest/install/tasks/main.yml b/roles/vm/guest/install/tasks/main.yml
index cf1286c5..0172c5bb 100644
--- a/roles/vm/guest/install/tasks/main.yml
+++ b/roles/vm/guest/install/tasks/main.yml
@@ -1,8 +1,9 @@
---
- name: create lvm-based disks for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'lvm') | list }}"
+ loop: "{{ install_cooked.disks.virtio | default({}) | combine(install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'lvm') | list }}"
loop_control:
label: "{{ item.value.vg }} / {{ item.value.lv }} ({{ item.value.size }})"
+ delegate_to: "{{ vm_host_cooked.name }}"
lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.value.lv }}"
@@ -10,7 +11,8 @@
state: present
- name: create zfs base datasets for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | map(attribute='value.backend') | map('default', 'default') | unique | list }}"
+ loop: "{{ install_cooked.disks.virtio | default({}) | combine(install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | map(attribute='value.backend') | map('default', 'default') | unique | list }}"
+ delegate_to: "{{ vm_host_cooked.name }}"
zfs:
name: "{{ vm_host_cooked.zfs[item].pool }}/{{ vm_host_cooked.zfs[item].name }}/{{ install_hostname }}"
state: present
@@ -19,72 +21,75 @@
mountpoint: none
- name: create zfs-based disk volumes for vm
- loop: "{{ hostvars[install_hostname].install_cooked.disks.virtio | default({}) | combine(hostvars[install_hostname].install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | list }}"
+ loop: "{{ install_cooked.disks.virtio | default({}) | combine(install_cooked.disks.scsi | default({})) | dict2items | selectattr('value.type', 'eq', 'zfs') | list }}"
loop_control:
label: "{{ item.value.name }} on backend {{ item.value.backend | default('default') }} ({{ item.value.size }})"
+ delegate_to: "{{ vm_host_cooked.name }}"
zfs:
name: "{{ vm_host_cooked.zfs[item.value.backend | default('default')].pool }}/{{ vm_host_cooked.zfs[item.value.backend | default('default')].name }}/{{ install_hostname }}/{{ item.value.name }}"
state: present
extra_zfs_properties: "{{ item.value.properties | default({}) | combine({'volsize': item.value.size}) }}"
-- block:
- - name: create a temporary workdir
- tempfile:
- path: "{{ installer_base_path }}/"
- prefix: ".{{ install_hostname }}."
- state: directory
- register: tmpdir
+- delegate_to: "{{ vm_host_cooked.name }}"
+ block:
+ - name: create a temporary workdir
+ tempfile:
+ path: "{{ hostvars[vm_host_cooked.name].installer_base_path }}/"
+ prefix: ".{{ install_hostname }}."
+ state: directory
+ register: tmpdir
- - when: install_distro in ['debian', 'ubuntu']
- import_tasks: installer-debian.yml
+ - when: install_distro in ['debian', 'ubuntu']
+ import_tasks: installer-debian.yml
- - when: install_distro in ['openbsd']
- import_tasks: installer-openbsd.yml
+ - when: install_distro in ['openbsd']
+ import_tasks: installer-openbsd.yml
- - name: Make installer workdir readable by qemu
- acl:
- path: "{{ tmpdir.path }}"
- state: present
- entity: libvirt-qemu
- etype: user
- permissions: rx
+ - name: Make installer workdir readable by qemu
+ acl:
+ path: "{{ tmpdir.path }}"
+ state: present
+ entity: libvirt-qemu
+ etype: user
+ permissions: rx
- - name: define installer vm
- vars:
- vm_define_installer: yes
- installer_tmpdir: "{{ tmpdir.path }}"
- import_role:
- name: vm/guest/define
+ - name: define installer vm
+ vars:
+ vm_define_installer: yes
+ installer_tmpdir: "{{ tmpdir.path }}"
+ import_role:
+ name: vm/guest/define
- - debug:
- msg: "you can check on the status of the installer running this command 'virsh console {{ install_hostname }}' on host {{ inventory_hostname }}."
+ - debug:
+ msg: "you can check on the status of the installer running this command 'virsh console {{ install_hostname }}' on host {{ vm_host_cooked.name }}."
- - when: installer_manual_steps_msg is defined
- pause:
- prompt: |
- Mind that this installer needs manual steps to be performed:
+ - when: installer_manual_steps_msg is defined
+ pause:
+ prompt: |
+ Mind that this installer needs manual steps to be performed:
- {{ installer_manual_steps_msg | indent(2) }}
+ {{ installer_manual_steps_msg | indent(2) }}
- When done press ENTER to continue or CTRL-C then A to abort.
+ When done press ENTER to continue or CTRL-C then A to abort.
- - name: wait for installer to finish or crash
- wait_for_virt:
- name: "{{ install_hostname }}"
- states: shutdown,crashed
- timeout: 1800
- register: installer_result
- failed_when: installer_result.failed or installer_result.state == "crashed"
+ - name: wait for installer to finish or crash
+ wait_for_virt:
+ name: "{{ install_hostname }}"
+ states: shutdown,crashed
+ timeout: 1800
+ register: installer_result
+ failed_when: installer_result.failed or installer_result.state == "crashed"
always:
- - name: cleanup temporary workdir
- file:
- path: "{{ tmpdir.path }}"
- state: absent
+ - name: cleanup temporary workdir
+ file:
+ path: "{{ tmpdir.path }}"
+ state: absent
- name: define vm
vars:
vm_define_installer: no
+ delegate_to: "{{ vm_host_cooked.name }}"
import_role:
name: vm/guest/define
diff --git a/spreadspace/vm-install.yml b/spreadspace/vm-install.yml
index b6a69b67..7d8e7320 100644
--- a/spreadspace/vm-install.yml
+++ b/spreadspace/vm-install.yml
@@ -1,5 +1,5 @@
---
-- name: cook variables for guest
+- name: cook variables for host
hosts: "{{ install_hostname }}"
gather_facts: no
tasks:
@@ -8,11 +8,4 @@
network_cooked: "{{ network }}"
vm_host_cooked: "{{ vm_host }}"
-- name: cook variables for host
- hosts: "{{ hostvars[install_hostname].vm_host.name }}"
- gather_facts: no
- tasks:
- - set_fact:
- vm_host_cooked: "{{ vm_host }}"
-
- import_playbook: ../common/vm-install.yml