diff options
Diffstat (limited to 'roles/installer/ubuntu/autoinstall')
-rw-r--r-- | roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 | 27 |
1 files changed, 17 insertions, 10 deletions
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 |