Compare commits

...

2 commits

Author SHA1 Message Date
82739c1ff0 music: Remove go
Some checks failed
Test / build (push) Failing after 58s
2025-05-16 17:40:51 +02:00
8e5b9f6b30 music/trollibox: Run as a distinct user 2025-05-16 17:36:03 +02:00
6 changed files with 22 additions and 16 deletions

View file

@ -47,7 +47,6 @@
- hosts: music - hosts: music
roles: roles:
- { role: "acme", tags: ["acme"] } - { role: "acme", tags: ["acme"] }
- { role: "go", tags: ["go"] }
- { role: "music", tags: ["music"] } - { role: "music", tags: ["music"] }
- hosts: pad - hosts: pad

View file

@ -5,6 +5,5 @@
- { role: "common", tags: [ "common" ] } - { role: "common", tags: [ "common" ] }
- { role: "acme", tags: [ "acme" ] } - { role: "acme", tags: [ "acme" ] }
- { role: "deb_forgejo", tags: [ "deb_forgejo" ] } - { role: "deb_forgejo", tags: [ "deb_forgejo" ] }
- { role: "go", tags: [ "go" ] }
- { role: "nginx", tags: [ "nginx" ] } - { role: "nginx", tags: [ "nginx" ] }
- { role: "music", tags: [ "music" ] } - { role: "music", tags: [ "music" ] }

View file

@ -1,6 +1,7 @@
music_audio_user: audio music_audio_user: audio
music_audio_group: audio music_audio_group: audio
music_librespot_user: librespot music_librespot_user: librespot
music_trollibox_user: trollibox
music_pulse_server: /tmp/pipewire-pulse-socket music_pulse_server: /tmp/pipewire-pulse-socket

View file

@ -8,7 +8,7 @@
state: restarted state: restarted
daemon_reload: true daemon_reload: true
- name: Restart trollibox - name: restart trollibox
ansible.builtin.systemd: ansible.builtin.systemd:
name: trollibox name: trollibox
state: restarted state: restarted

View file

@ -1,4 +1,10 @@
--- ---
- name: Create trollibox user
user:
name: "{{ music_trollibox_user }}"
system: true
home: /var/lib/trollibox
- name: Install Trollibox config - name: Install Trollibox config
ansible.builtin.template: ansible.builtin.template:
src: trollibox.yaml src: trollibox.yaml
@ -6,27 +12,29 @@
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
notify: Restart trollibox notify: restart trollibox
- name: Get latest Trollibox version from Github API - name: Get latest Trollibox version from Github API
ansible.builtin.get_url: uri:
url: "https://api.github.com/repos/polyfloyd/trollibox/releases/latest" url: "https://api.github.com/repos/polyfloyd/trollibox/releases/latest"
dest: "/tmp/_ansible_trollibox_latest_release.json" return_content: true
register: response
changed_when: false
check_mode: false
failed_when: "response is failed or 'json' not in response"
- name: Get download url - name: Format trollibox latest version
ansible.builtin.shell: set_fact:
cmd: cat /tmp/_ansible_trollibox_latest_release.json | jq .assets[] | select(.name trollibox_version: "{{ response['json']['tag_name'] | trim('v') }}"
| contains("linux-amd64")) | .browser_download_url -r
register: "trollibox_download_url"
- name: Download Trollibox - name: Download Trollibox
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ trollibox_download_url.stdout }}" src: "https://github.com/polyfloyd/trollibox/releases/download/v{{ trollibox_version }}/trollibox-x86_64-unknown-linux-gnu.tar.gz"
remote_src: yes remote_src: yes
dest: /usr/local/bin dest: /usr/local/bin
include: [ trollibox ] include: [ trollibox ]
mode: "0755" mode: "0755"
notify: Restart trollibox notify: restart trollibox
- name: Install service file - name: Install service file
ansible.builtin.template: ansible.builtin.template:
@ -35,7 +43,7 @@
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
notify: Restart trollibox notify: restart trollibox
- name: Enable Trollibox - name: Enable Trollibox
ansible.builtin.systemd: ansible.builtin.systemd:

View file

@ -10,8 +10,7 @@ Type=simple
Restart=always Restart=always
RestartSec=2s RestartSec=2s
ExecStart=/usr/local/bin/trollibox -conf /etc/trollibox.yaml ExecStart=/usr/local/bin/trollibox -conf /etc/trollibox.yaml
User={{ music_audio_user }} User={{ music_trollibox_user }}
Group={{ music_audio_user }}
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target