- set_fact: baseline_pkgs: - bridge-utils - libvirt - qemu - name: required baseline packages ansible.builtin.shell: executable: /bin/bash cmd: | set -e for pkgname in {{ baseline_pkgs | join(' ') }}; do echo -n $pkgname ... if [[ {{ansible_check_mode}} = True ]]; then ls /var/log/packages/$pkgname-* >/dev/null 2>&1 && echo there || echo WILL INSTALL IN PLAY elif [[ {{ansible_check_mode}} = False ]]; then ls /var/log/packages/$pkgname-* >/dev/null 2>&1 && echo there || slackpkg -dialog=off -batch=on -default_answer=y install $pkgname fi done; unset pkgname register: baseline changed_when: > 'WILL INSTALL IN PLAY' in baseline.stdout or 'Installing package' in baseline.stdout check_mode: false - debug: var=baseline.stdout when: baseline.stdout != '' - debug: var=baseline.stderr when: baseline.stderr != '' - name: rc.local ansible.builtin.copy: content: | #!/bin/bash # CONFIGURED BY ANSIBLE echo rc.local PATH is $PATH # self-verbose /etc/rc.d/rc.libvirt start dest: /etc/rc.d/rc.local mode: "0755" - name: console goes ttyS0 lineinfile: path: /etc/inittab regexp: '^s1:' line: 's1:12345:respawn:/sbin/agetty --noclear --local-line ttyS0 115200 linux'