---
## Disable uart
- name: Disable uart
  ansible.builtin.lineinfile:
    path: /boot/firmware/config.txt
    regexp: '^enable_uart='
    line: enable_uart=0
  notify: "Reboot Server"
  when: board == "pi4"

# Always Fix fsck
- name: Fix FSCK
  shell: cat /boot/firmware/cmdline.txt | grep -c 'fsck.repair=' || true
  register: pi_fsck_repair
  changed_when: false # Do not mark as 'changed'
  when: board == "pi4"

- name: Add cpuset cgroup
  replace: dest=/boot/firmware/cmdline.txt regexp='(\s*)$' replace=' fsck.repair=yes'
  when: board == "pi4" and pi_fsck_repair.stdout == "0"
  notify: "Reboot Server"

# avahi
- name: Avahi Domain
  community.general.ini_file:
    path: /etc/avahi/avahi-daemon.conf
    section: server
    option: domain-name
    value: local
  notify: "Reboot Server"
