--- - name: Prepare hosts: all gather_facts: false tasks: - name: Update cache # noqa no-changed-when ansible.builtin.raw: apt update - name: Install required packages # noqa no-changed-when ansible.builtin.raw: apt install -y python3 sudo - name: Install required packages # noqa no-changed-when ansible.builtin.shell: | set -o pipefail apt install -y systemd find /etc/systemd/system/*.wants /lib/systemd/system/multi-user.target.wants /lib/systemd/system/local-fs.target.wants /lib/systemd/system/sockets.target.wants -type f -name '*initctl*' -delete find /lib/systemd/system/sysinit.target.wants -type f ! -name '*systemd-tmpfiles-setup*' -delete find /lib/systemd -type f -name systemd-update-utmp-runlevel.service -delete rm -vf /usr/share/systemd/tmp.mount sed -ri '/^IPAddressDeny/d' /lib/systemd/system/systemd-journald.service for MATCH in plymouth-start.service plymouth-quit-wait.service syslog.socket syslog.service display-manager.service systemd-sysusers.service tmp.mount systemd-udevd.service; do \ grep -rn --binary-files=without-match ${MATCH} /lib/systemd/ | cut -d: -f1 | xargs -r sed -ri 's/(.*=.*)'${MATCH}'(.*)/\1\2/'; \ done systemctl disable ondemand.service systemctl set-default multi-user.target become: true args: executable: /bin/bash environment: DEBIAN_FRONTEND: noninteractive