ansible/roles/raspi/tasks/main.yaml

26 lines
609 B
YAML

---
- name: Check whether user pi exists
command: "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
user:
name: pi
password: !
when: pi_user_check.stdout_lines|length > 0
- name: Enable sshd
systemd:
name: sshd
enabled: yes
state: started
- name: Rotate display
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