ansible/roles/music/tasks/trollibox.yaml

53 lines
1.4 KiB
YAML

---
- name: Create trollibox user
user:
name: "{{ music_trollibox_user }}"
system: true
home: /var/lib/trollibox
- name: Install Trollibox config
ansible.builtin.template:
src: trollibox.yaml
dest: /etc/trollibox.yaml
owner: root
group: root
mode: "0644"
notify: restart trollibox
- name: Get latest Trollibox version from Github API
uri:
url: "https://api.github.com/repos/polyfloyd/trollibox/releases/latest"
return_content: true
register: response
changed_when: false
check_mode: false
failed_when: "response is failed or 'json' not in response"
- name: Format trollibox latest version
set_fact:
trollibox_version: "{{ response['json']['tag_name'] | trim('v') }}"
- name: Download Trollibox
ansible.builtin.unarchive:
src: "https://github.com/polyfloyd/trollibox/releases/download/v{{ trollibox_version }}/trollibox-x86_64-unknown-linux-gnu.tar.gz"
remote_src: yes
dest: /usr/local/bin
include: [ trollibox ]
mode: "0755"
notify: restart trollibox
- name: Install service file
ansible.builtin.template:
src: trollibox.service
dest: /etc/systemd/system/trollibox.service
owner: root
group: root
mode: "0644"
notify: restart trollibox
- name: Enable Trollibox
ansible.builtin.systemd:
name: trollibox
state: started
enabled: true
daemon_reload: true