Files
ansible/roles/pi_shairport/tasks/main.yml
Martin Bauer f2f50e98e1 Build shairport-sync 4.3.7 from its tag
The task passed the script `${shairport_sync_version}` - shell syntax in a Jinja field,
and the wrong variable name - which the Pi's shell expanded to nothing, so the script
fell back to its own default. Its `git reset` then ran outside the fresh clone, failed,
and was ignored without `set -e`: every build was simply upstream master. The script
now takes `pi_shairport_sync_version`, requires the argument, clones that tag directly
and stops on the first error. Bumped to 4.3.7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 23:15:48 +02:00

44 lines
1.7 KiB
YAML

---
- name: Apt install dependencies
ansible.builtin.apt:
cache_valid_time: 7200
state: present
# systemd-dev: --with-systemd takes the unit directory from systemd.pc, which trixie
# moved out of the systemd package. Without it `make install` fails right after
# installing the binary, with an empty `install -d`.
name: >-
{{ ['build-essential', 'git', 'xmltoman', 'autoconf', 'automake', 'libtool',
'libpopt-dev', 'libconfig-dev', 'libasound2-dev', 'avahi-daemon',
'libavahi-client-dev', 'libssl-dev', 'libsoxr-dev']
+ (['systemd-dev'] if ansible_facts.distribution_major_version | int >= 13 else []) }}
- name: Build and Install Shairport sync (may take a while)
ansible.builtin.script: "build-shairport-sync.sh {{ pi_shairport_sync_version }}"
args:
# The unit file rather than the binary: make install puts the binary in place
# first, so a build that failed halfway would otherwise never be retried.
creates: /lib/systemd/system/shairport-sync.service
notify: Restart shairport-sync
- name: Copy config
ansible.builtin.template:
src: shairport-sync.conf
dest: /etc/shairport-sync.conf
mode: "0644"
notify: Restart shairport-sync
- name: Modify service file to run as root
ansible.builtin.lineinfile:
path: /lib/systemd/system/shairport-sync.service
regexp: "^#?User="
line: "User=root"
notify: Restart shairport-sync
- name: Enable shairport-sync autostart
ansible.builtin.systemd:
name: shairport-sync
state: started
enabled: "yes"
daemon_reload: "yes"
- name: Add to sysdweb
ansible.builtin.include_role:
name: pi_sysdweb
vars:
pi_sysdweb_name: shairport-sync