ansible/roles/music/tasks/trollibox.yaml

45 lines
1.2 KiB
YAML

---
- 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
ansible.builtin.get_url:
url: "https://api.github.com/repos/polyfloyd/trollibox/releases/latest"
dest: "/tmp/_ansible_trollibox_latest_release.json"
- name: Get download url
ansible.builtin.shell:
cmd: cat /tmp/_ansible_trollibox_latest_release.json | jq .assets[] | select(.name
| contains("linux-amd64")) | .browser_download_url -r
register: "trollibox_download_url"
- name: Download Trollibox
ansible.builtin.unarchive:
src: "{{ trollibox_download_url.stdout }}"
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