diff options
author | Christian Pointner <equinox@spreadspace.org> | 2024-04-27 02:26:23 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2024-04-27 02:26:23 +0200 |
commit | 012046624239206f4989d64d6d2f2b68b71b805d (patch) | |
tree | 412d453b1e18f12c4e2499b89a82ba297e1ba30b | |
parent | initial support for ubuntu 24.04 (diff) |
autoselection for installer_variant and some more ubunut noble fixes
-rw-r--r-- | common/iso-generate.yml | 12 | ||||
-rw-r--r-- | common/iso-install.yml | 14 | ||||
-rw-r--r-- | common/usb-generate.yml | 12 | ||||
-rw-r--r-- | common/usb-install.yml | 14 | ||||
-rw-r--r-- | inventory/group_vars/all/vars.yml | 9 | ||||
-rw-r--r-- | roles/apt-repo/base/tasks/main.yml | 16 | ||||
-rw-r--r-- | roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 | 27 | ||||
-rw-r--r-- | roles/vm/guest/install/tasks/main.yml | 9 |
8 files changed, 61 insertions, 52 deletions
diff --git a/common/iso-generate.yml b/common/iso-generate.yml index 78047e13..d6a00ed7 100644 --- a/common/iso-generate.yml +++ b/common/iso-generate.yml @@ -3,9 +3,9 @@ hosts: "{{ install_hostnames }}" connection: local gather_facts: no - vars: - installer_variant: debian - roles: - - role: "installer/{{ installer_variant }}/iso" - installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" - installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" + tasks: + - vars: + installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" + installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" + include_role: + name: "installer/{{ installer_variant }}/iso" diff --git a/common/iso-install.yml b/common/iso-install.yml index 3088b107..779d917f 100644 --- a/common/iso-install.yml +++ b/common/iso-install.yml @@ -3,13 +3,13 @@ hosts: "{{ install_hostname }}" connection: local gather_facts: no - vars: - installer_variant: debian - roles: - - role: "installer/{{ installer_variant }}/iso" - installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" - installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" - post_tasks: + tasks: + - vars: + installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" + installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" + include_role: + name: "installer/{{ installer_variant }}/iso" + - set_fact: iso_install_image_path: "{{ iso_install_target_dir }}/{{ install_hostname }}.iso" diff --git a/common/usb-generate.yml b/common/usb-generate.yml index 7031839c..ffb780bb 100644 --- a/common/usb-generate.yml +++ b/common/usb-generate.yml @@ -3,13 +3,13 @@ hosts: "{{ install_hostnames }}" connection: local gather_facts: no - vars: - installer_variant: debian vars_prompt: - name: usb_install_path prompt: "Path to the the USB installation mountpoint or device" private: no - roles: - - role: "installer/{{ installer_variant }}/usb" - installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" - installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" + tasks: + - vars: + installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" + installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" + include_role: + name: "installer/{{ installer_variant }}/usb" diff --git a/common/usb-install.yml b/common/usb-install.yml index a909e679..fa901594 100644 --- a/common/usb-install.yml +++ b/common/usb-install.yml @@ -3,17 +3,17 @@ hosts: "{{ install_hostname }}" connection: local gather_facts: no - vars: - installer_variant: debian vars_prompt: - name: usb_install_path prompt: "Path to the the USB installation mountpoint or device" private: no - roles: - - role: "installer/{{ installer_variant }}/usb" - installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" - installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" - post_tasks: + tasks: + - vars: + installer_base_path: "{{ global_cache_dir }}/{{ installer_variant }}-installer" + installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" + include_role: + name: "installer/{{ installer_variant }}/usb" + - pause: prompt: | Please unmount the USB the stick, plug it into the machine and boot from it. diff --git a/inventory/group_vars/all/vars.yml b/inventory/group_vars/all/vars.yml index 03bce8d5..310a9784 100644 --- a/inventory/group_vars/all/vars.yml +++ b/inventory/group_vars/all/vars.yml @@ -7,6 +7,15 @@ global_cache_dir: "{{ inventory_dir }}/../.cache" global_files_dir: "{{ inventory_dir }}/../files" +__installer_variant_map__: + debian: debian + ubuntu: ubuntu + openbsd: openbsd + kali: debian + +installer_variant: "{{ __installer_variant_map__[install_distro] }}" + + ssh_users_root: - equinox ssh_keys_root: "{{ ssh_users_root | default([]) | map('extract', users) | map(attribute='ssh') | flatten | list }}" diff --git a/roles/apt-repo/base/tasks/main.yml b/roles/apt-repo/base/tasks/main.yml index 132f7702..668f6453 100644 --- a/roles/apt-repo/base/tasks/main.yml +++ b/roles/apt-repo/base/tasks/main.yml @@ -5,6 +5,14 @@ dest: /etc/apt/sources.list register: apt_repo_base_sources +- name: remove new-style ubuntu apt source entries + loop: + - ubuntu.sources + - ubuntu.sources.curtin.orig + file: + path: "/etc/apt/sources.list.d/{{ item }}" + state: absent + - name: update apt cache when: apt_repo_base_sources is changed command: apt-get update @@ -26,11 +34,3 @@ file: path: /etc/apt/apt.conf.d/20apt-esm-hook.conf state: absent - -- name: remove new-style ubuntu apt source entries - loop: - - ubuntu.sources - - ubuntu.sources.curtin.orig - file: - path: "/etc/apt/sources.list.d/{{ item }}" - state: absent diff --git a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 index 2a5ad758..7ab7fa91 100644 --- a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 +++ b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 @@ -216,21 +216,28 @@ autoinstall: {% for key in ssh_keys_root %} - {{ key }} {% endfor %} - runcmd: - - [ apt-get, -y, -q, purge, cloud-init, cloud-guest-utils, cloud-initramfs-copymods, cloud-initramfs-dyn-netconf, sosreport, update-notifier-common ] + write_files: + - content: | + #!/bin/bash + 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 ] + 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 -r dpkg -P' ] - - [ sed, '/^PasswordAuthentication /d', -i, '/etc/ssh/sshd_config' ] - - [ rm, -f, '/etc/ssh/sshd_config.d/50-cloud-init.conf' ] + rm -rf /etc/cloud /var/lib/cloud + apt-get -y -q auto-remove + dpkg -l | grep "^rc" | awk "{ print(\$2) }" | xargs -r dpkg -P + sed '/^PasswordAuthentication /d' -i '/etc/ssh/sshd_config' + rm -f '/etc/ssh/sshd_config.d/50-cloud-init.conf' + rm -f /root/post-cleanup.sh {% if ubuntu_autoinstall_poweroff_when_done %} - - [ poweroff ] + poweroff {% else %} - - [ reboot ] + reboot {% endif %} + path: /root/post-cleanup.sh + permissions: '0755' + runcmd: + - ['systemd-run', '-p', 'StandardOutput=journal+console', '--on-active=10', '/root/post-cleanup.sh'] ssh: install-server: true diff --git a/roles/vm/guest/install/tasks/main.yml b/roles/vm/guest/install/tasks/main.yml index 0cb7b925..e79a3ef5 100644 --- a/roles/vm/guest/install/tasks/main.yml +++ b/roles/vm/guest/install/tasks/main.yml @@ -41,14 +41,7 @@ state: directory register: vm_install_tmpdir - - when: install_distro in ['debian', 'kali'] - include_tasks: installer-debian.yml - - - when: install_distro in ['ubuntu'] - include_tasks: installer-ubuntu.yml - - - when: install_distro in ['openbsd'] - include_tasks: installer-openbsd.yml + - include_tasks: "installer-{{ installer_variant }}.yml" - name: Make installer workdir readable by qemu acl: |