ansible/roles/music/tasks/soundboard.yaml

50 lines
1.1 KiB
YAML

---
- name: Install dependencies
ansible.builtin.apt:
name: virtualenv
state: present
- name: Clone soundboard source
ansible.builtin.git:
repo: https://github.com/polyfloyd/mqtt-soundboard.git
version: main
dest: /opt/soundboard
accept_hostkey: yes
notify: Restart soundboard
- name: Create virtualenv
ansible.builtin.command:
cmd: virtualenv /opt/soundboard/.venv
args:
creates: /opt/soundboard/.venv
- name: Install Python dependencies
ansible.builtin.shell:
cmd: . .venv/bin/activate && pip install -r requirements.txt
args:
chdir: /opt/soundboard
- name: Install soundboard config file
ansible.builtin.template:
src: soundboard.yaml
dest: /etc/soundboard.yaml
owner: root
group: root
mode: 0644
notify: Restart soundboard
- name: Install soundboard service file
ansible.builtin.template:
src: soundboard.service
dest: /etc/systemd/system/soundboard.service
owner: root
group: root
mode: 0644
notify: Restart soundboard
- name: Enable soundboard
ansible.builtin.systemd:
name: soundboard
state: started
enabled: true
daemon_reload: true