From f24e8b6436dc850414eb099786f897509478903a Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Sat, 2 Oct 2021 16:31:21 +0200 Subject: [PATCH] Add a role to install Trollibox --- hosts | 3 +++ roles/music/handlers/main.yaml | 17 +++++++++++++++++ roles/music/tasks/main.yaml | 3 +++ roles/music/tasks/trollibox.yaml | 13 +++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 roles/music/handlers/main.yaml create mode 100644 roles/music/tasks/main.yaml create mode 100644 roles/music/tasks/trollibox.yaml diff --git a/hosts b/hosts index 31415d3..b3def02 100644 --- a/hosts +++ b/hosts @@ -3,3 +3,6 @@ bank-pi.bitlair.nl [mqtt_internal] mqtt.bitlair.nl + +[music] +music.bitlair.nl diff --git a/roles/music/handlers/main.yaml b/roles/music/handlers/main.yaml new file mode 100644 index 0000000..43f7a73 --- /dev/null +++ b/roles/music/handlers/main.yaml @@ -0,0 +1,17 @@ +--- +- name: reload nginx + systemd: + name: nginx + state: reloaded + +- name: rebuild trollibox + command: ./build.sh + args: + chdir: /opt/trollibox + environment: { RELEASE: 1 } + +- name: restart trollibox + systemd: + name: trollibox + state: restarted + daemon_reload: true diff --git a/roles/music/tasks/main.yaml b/roles/music/tasks/main.yaml new file mode 100644 index 0000000..73a6ac8 --- /dev/null +++ b/roles/music/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- tags: music_trollibox + include: trollibox.yaml diff --git a/roles/music/tasks/trollibox.yaml b/roles/music/tasks/trollibox.yaml new file mode 100644 index 0000000..1e094eb --- /dev/null +++ b/roles/music/tasks/trollibox.yaml @@ -0,0 +1,13 @@ +--- +- name: Clone trollibox source + git: + repo: https://github.com/polyfloyd/trollibox.git + version: master + dest: /opt/trollibox + accept_hostkey: yes + notify: + - rebuild trollibox + - restart trollibox + +- name: Initial build + meta: flush_handlers