Files
Martin Bauer cb0ece0478 Keep the media-pi roles working on trixie
- pi_hifiberry_amp: the boot config lives at /boot/firmware/config.txt.
- pi_sysdweb: install python3-dbus and python3-systemd from apt, which trixie ships at
  the versions sysdweb needs; bookworm gets the headers pip needs to build dbus-python
  1.4 itself.
- pi_squeezeserver: trixie images have no iptables, and so cannot have the port 80
  redirect that absent.yml removes - skip that step there instead of failing.
- pi_modern_shell_env, pi_slint_frontend: read facts through `ansible_facts` rather than
  the deprecated injected `ansible_*` variables.

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

71 lines
2.5 KiB
YAML

---
# The mirror image of present.yml. Worth having as a real code path rather than a
# one-off ssh session: musicdolphin had LMS running because some earlier provisioning
# put it there, no playbook has installed it since, and nothing on the network used
# it - every squeezelite in the fleet points at `pi_squeezelite_squeezeserver`
# (192.168.178.80, the server), not at the pi it happens to be running on. On a 2 GB Pi
# that is also driving a kiosk browser, a stray Perl daemon holding ~30 MB resident and
# ~47 MB of swap is worth reclaiming.
- name: Check whether the Logitech Media Server unit is there at all
ansible.builtin.stat:
path: /lib/systemd/system/logitechmediaserver.service
register: pi_squeezeserver_unit
- name: Stop and disable the Logitech Media Server
# Before the package goes, so systemd is told rather than left holding a unit file
# that vanishes underneath it.
ansible.builtin.systemd:
name: logitechmediaserver
state: stopped
enabled: false
when: pi_squeezeserver_unit.stat.exists
- name: Purge the Logitech Media Server package
ansible.builtin.apt:
name: logitechmediaserver
state: absent
purge: true
autoremove: true
- name: Drop the Logitech Media Server from sysdweb
# Same marker pi_sysdweb writes, so this removes exactly the block that role added.
ansible.builtin.blockinfile:
path: /etc/sysdweb.conf
marker: "# {mark} ansible managed for logitechmediaserver"
state: absent
notify: Restart sysdweb after dropping the LMS entry
- name: Check whether iptables is installed
# Trixie images ship nftables only. A host without iptables cannot have the redirect
# below (present.yml installs iptables-persistent), so there is nothing to undo.
ansible.builtin.command: which iptables
register: pi_squeezeserver_iptables
changed_when: false
failed_when: false
check_mode: false # read-only
- name: Undo the port 80 -> 9000 redirect the install added
when: pi_squeezeserver_iptables.rc == 0
ansible.builtin.iptables:
table: nat
chain: PREROUTING
in_interface: eth0
protocol: tcp
match: tcp
destination_port: "80"
jump: REDIRECT
to_ports: "9000"
comment: Redirect web traffic to port 9000
state: absent
- name: Remove the server's database and logs
# apt purge takes /usr/share/squeezeboxserver (118 MB) with it but leaves these. They
# are a scan cache and a log of a server nobody talked to.
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- /var/lib/squeezeboxserver
- /var/log/squeezeboxserver