---
- name: Remove dtparam=audio=on
  become: true
  ansible.builtin.lineinfile:
    line: dtparam=audio=on
    dest: /boot/config.txt
    state: absent
  notify: Restart system

- name: Set audio=off for dtoverlay=vc4-kms-v3d
  become: true
  ansible.builtin.lineinfile:
    regexp: ^dtoverlay=vc4-kms-v3d
    line: dtoverlay=vc4-kms-v3d,audio=off
    dest: /boot/config.txt
  notify: Restart system

- name: Add hifiberry dtoverlay
  become: true
  ansible.builtin.lineinfile:
    line: "dtoverlay={{ hifiberry__device }}"
    dest: /boot/config.txt
  notify: Restart system