-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapserver.yaml
38 lines (37 loc) · 1.11 KB
/
snapserver.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
- name: Run latest snapcast server
hosts: snapserver
remote_user: ansible
become: yes
become_user: root
vars:
name_pattern: "{{ 'snapserver_.*_amd64' if ansible_architecture == 'x86_64' else 'snapserver_.*_armhf' if ansible_architecture == 'armv7l' else 'unsupported'}}"
tasks:
- name: get latest releases
uri:
method: GET
url: "https://api.github.com/repos/badaix/snapcast/releases"
return_content: yes
headers:
Accept: application/json
register: releases
- debug:
msg: " Using name pattern :{{ name_pattern }}"
- set_fact:
release: "{{ releases.json[0].assets | selectattr('browser_download_url', 'search', name_pattern) | first }}"
- debug:
msg: "{{release}}"
- name: download tarball
get_url:
dest: "/tmp/"
url: "{{release.browser_download_url}}"
- debug:
msg: "/tmp/{{release.name}}"
- name: install .deb
apt:
deb: "/tmp/{{release.name}}"
- name: Startd systemd unit
systemd:
name: snapserver.service
enabled: yes
state: restarted