From f4969bbc97a390adde7a8597ecf23ac495910991 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 5 Sep 2022 23:22:02 +0200 Subject: ubuntu/installer: add support for desktop installs --- .../ubuntu/autoinstall/templates/autoinstall.yml.j2 | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2') diff --git a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 index 7add2640..4d83c6b2 100644 --- a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 +++ b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 @@ -211,7 +211,10 @@ autoinstall: - {{ key }} {% endfor %} runcmd: - - [ apt-get, -y, -q, purge, snapd, cloud-init, cloud-guest-utils, cloud-initramfs-copymods, cloud-initramfs-dyn-netconf, python3-cryptography, gpg, sosreport, update-notifier-common, ssh-import-id ] + - [ apt-get, -y, -q, purge, cloud-init, cloud-guest-utils, cloud-initramfs-copymods, cloud-initramfs-dyn-netconf, sosreport, update-notifier-common ] +{% if ubuntu_autoinstall_desktop is undefined %} + - [ apt-get, -y, -q, purge, snapd, python3-cryptography, gpg, ssh-import-id ] +{% endif %} - [ rm, -rf, /etc/cloud, /var/lib/cloud ] - [ apt-get, -y, -q, auto-remove ] - [ bash, -c, 'dpkg -l | grep "^rc" | awk "{ print(\$2) }" | xargs dpkg -P' ] @@ -228,6 +231,9 @@ autoinstall: packages: - python3 - python3-apt +{% if ubuntu_autoinstall_desktop is defined %} + - {{ ubuntu_autoinstall_desktop }}-desktop^ +{% endif %} {% for task in ubuntu_autoinstall_install_tasks %} - {{ task }}^ {% endfor %} @@ -237,20 +243,25 @@ autoinstall: {% if ansible_port is defined %} - curtin in-target --target=/target -- sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config {% endif %} - - curtin in-target --target=/target -- apt-mark manual iputils-ping isc-dhcp-client netcat-openbsd netplan.io sudo - - curtin in-target --target=/target -- apt-get -y -q purge policykit-1 multipath-tools ubuntu-minimal unattended-upgrades sound-theme-freedesktop thin-provisioning-tools cryptsetup byobu open-iscsi btrfs-progs pollinate lxd-agent-loader open-vm-tools + - curtin in-target --target=/target -- apt-get -y -q purge multipath-tools open-vm-tools {% if ubuntu_installer_codename != 'focal' %} - curtin in-target --target=/target -- apt-get -y -q purge systemd-oomd {% endif %} -{% if install.disks.primary != "software-raid" %} +{% if ubuntu_autoinstall_desktop is undefined %} + - curtin in-target --target=/target -- apt-mark manual iputils-ping isc-dhcp-client netcat-openbsd netplan.io sudo + - curtin in-target --target=/target -- apt-get -y -q purge policykit-1 ubuntu-minimal unattended-upgrades sound-theme-freedesktop thin-provisioning-tools cryptsetup byobu open-iscsi btrfs-progs pollinate lxd-agent-loader +{% if install.disks.primary != "software-raid" %} - curtin in-target --target=/target -- apt-get -y -q purge mdadm -{% endif %} +{% endif %} - curtin in-target --target=/target -- env SUDO_FORCE_REMOVE=yes apt-get -y -q purge sudo +{% endif %} - curtin in-target --target=/target -- apt-get -y -q autoremove - curtin in-target --target=/target -- bash -c 'dpkg -l | grep "^rc" | awk "{ print(\$2) }" | xargs dpkg -P' +{% if ubuntu_autoinstall_desktop is undefined %} {# purging the snapd package here would trigger a bug in den postrm script because some filesystems in /run/ can not be unmounted... #} {# to workadound this issue we only remove the package here and rely on cloud-init to fully purge it on first boot (see user-data: above) #} - curtin in-target --target=/target -- apt-get -y -q remove snapd +{% endif %} - curtin in-target --target=/target -- bash -c 'apt-get update -q && apt-get full-upgrade -y -q' {% if ubuntu_autoinstall_kernel_image is defined or ubuntu_autoinstall_virtual_machine %} -- cgit v1.2.3