62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
---
|
|
- name: Install package
|
|
ansible.builtin.apt:
|
|
deb: "https://github.com/navidrome/navidrome/releases/download/v{{ navidrome_version }}/navidrome_{{ navidrome_version }}_linux_{{ navidrome_arch }}.deb"
|
|
|
|
- name: Create directories
|
|
ansible.builtin.file:
|
|
state: directory
|
|
path: "{{ item }}"
|
|
owner: "{{ navidrome_user }}"
|
|
group: "{{ navidrome_group }}"
|
|
mode: "0755"
|
|
loop:
|
|
- "{{ navidrome_music_folder }}"
|
|
- "{{ navidrome_data_folder }}"
|
|
- "{{ navidrome_cache_folder }}"
|
|
|
|
- name: Create configuration file
|
|
ansible.builtin.template:
|
|
src: navidrome.toml.j2
|
|
dest: /etc/navidrome/navidrome.toml
|
|
owner: "{{ navidrome_user }}"
|
|
group: "{{ navidrome_group }}"
|
|
mode: "0644"
|
|
notify:
|
|
- Restart navidrome
|
|
|
|
- name: Create systemd override directory
|
|
ansible.builtin.file:
|
|
state: directory
|
|
path: /etc/systemd/system/navidrome.service.d
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
|
|
- name: Add systemd override
|
|
ansible.builtin.template:
|
|
src: override.conf.j2
|
|
dest: /etc/systemd/system/navidrome.service.d/override.conf
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
notify:
|
|
- Reload systemd
|
|
- Restart navidrome
|
|
|
|
- name: Start service
|
|
ansible.builtin.service:
|
|
name: navidrome
|
|
state: started
|
|
|
|
- name: Manage iptables
|
|
ansible.builtin.iptables:
|
|
chain: INPUT
|
|
protocol: tcp
|
|
source: "{{ item }}"
|
|
destination_port: "{{ navidrome_port }}"
|
|
jump: ACCEPT
|
|
comment: navidrome
|
|
loop: "{{ navidrome_allowed_sources }}"
|
|
notify: Save iptables
|
|
when: navidrome_manage_iptables
|