--- - name: Check whether user pi exists ansible.builtin.command: cmd: 'grep ^pi: /etc/passwd' changed_when: no failed_when: pi_user_check.rc != 0 and pi_user_check.rc != 1 register: pi_user_check - name: Disable default user ansible.builtin.user: name: pi password: ! when: pi_user_check.stdout_lines|length > 0 - name: Enable sshd ansible.builtin.systemd: name: sshd enabled: yes state: started - name: Rotate display ansible.builtin.lineinfile: path: /boot/config.txt line: "display_rotate={{ raspi_rotate_display }} # Managed by Ansible" regexp: "^#?display_rotate" when: raspi_rotate_display is defined notify: reboot - name: Disable swap block: - name: Stop swap service ansible.builtin.systemd: name: dphys-swapfile state: stopped enabled: no - name: Remove swap file ansible.builtin.command: cmd: dphys-swapfile uninstall args: removes: /var/swap - name: Enable IPv6 SLAAC ansible.builtin.lineinfile: path: /etc/dhcpcd.conf line: "slaac hwaddr # Managed by Ansible" regexp: "^#?slaac" notify: reboot