--- - name: Ensure acl is installed ansible.builtin.apt: name: acl - name: Ensure machine-info file is deployed ansible.builtin.template: src: machine-info.j2 dest: /etc/machine-info mode: 0644 owner: root group: root notify: Restart bluetooth service - name: Ensure bluetooth config is deployed ansible.builtin.template: src: main.conf.j2 dest: /etc/bluetooth/main.conf mode: 0644 owner: root group: root notify: Restart bluetooth service - name: Ensure bluetooth service is enabled and started ansible.builtin.systemd: service: bluetooth.service state: started enabled: true - name: Ensure audiosink user exists ansible.builtin.user: name: audiosink groups: - audio - name: Ensure user services are started without needing to login ansible.builtin.command: cmd: loginctl enable-linger audiosink changed_when: false - name: Detect if on Raspberry Pi # noqa ignore-errors ansible.builtin.include_role: name: raspberry_pi_check ignore_errors: true - name: Ensure debian archive keyring is installed # noqa no-handler when: raspberry_pi_check__cpuinfo.found ansible.builtin.apt: deb: https://ftp.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2021.1.1_all.deb - name: Ensure debian backports repository is enabled ansible.builtin.include_role: name: add_apt_repository vars: add_apt_repository__https_repo: false add_apt_repository__repo: "deb http://deb.debian.org/debian {{ ansible_facts.lsb.codename }}-backports main contrib non-free" add_apt_repository__filename: "{{ ansible_facts.lsb.codename }}-backports.list" - name: Ensure pipewire, wireplumber and libspa-0.2-bluetooth are installed ansible.builtin.apt: name: - pipewire - wireplumber - libspa-0.2-bluetooth default_release: "{{ ansible_facts.lsb.codename }}-backports" - name: Ensure pipewire user service is enabled and started become_user: audiosink ansible.builtin.systemd: name: pipewire.service state: started enabled: true scope: user - name: Ensure pipewire-pulse user service is enabled and started become_user: audiosink ansible.builtin.systemd: name: pipewire-pulse.service state: started enabled: true scope: user - name: Ensure wireplumber user service is enabled become_user: audiosink ansible.builtin.systemd: name: wireplumber.service enabled: true scope: user - name: Ensure speaker-agent dependencies are installed ansible.builtin.apt: name: - git - python3-dbus - name: Ensure speaker-agent repository is cloned ansible.builtin.git: repo: https://github.com/fdanis-oss/pw_wp_bluetooth_rpi_speaker.git dest: /opt/speaker-agent version: 9a939a23865ea020816017e06fd2290f301c35f9 - name: Ensure .config directory exists become_user: audiosink ansible.builtin.file: path: /home/audiosink/.config state: directory mode: 0700 owner: audiosink group: audiosink - name: Ensure .config/systemd directory exists become_user: audiosink ansible.builtin.file: path: /home/audiosink/.config/systemd state: directory mode: 0755 owner: audiosink group: audiosink - name: Ensure .config/systemd/user directory exists become_user: audiosink ansible.builtin.file: path: /home/audiosink/.config/systemd/user state: directory mode: 0755 owner: audiosink group: audiosink - name: Ensure speaker-agent service file is deployed become_user: audiosink ansible.builtin.copy: src: speaker-agent.service dest: /home/audiosink/.config/systemd/user/speaker-agent.service mode: 0644 owner: audiosink group: audiosink notify: Restart speaker-agent service - name: Ensure speaker-agent service is enabled and started become_user: audiosink ansible.builtin.systemd: name: speaker-agent.service state: started enabled: true scope: user # This part is janky, but I don't know how to make the bluetooth service, wireplumber and pipewire # work with each other without being logged in. - name: Ensure getty@tty1 override file is deployed ansible.builtin.copy: src: override.conf dest: /etc/systemd/system/getty@tty1.service.d/override.conf mode: 0644 owner: root group: root notify: Reboot host - name: Ensure autologin for audiosink user is enabled ansible.builtin.systemd: service: getty@tty1.service enabled: true notify: Reboot host