60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
- name: Create Navidrome user
|
|
user:
|
|
name: navidrome
|
|
home: "{{ dataroot }}/navidrome"
|
|
create_home: no
|
|
|
|
- name: Deploy SSH key for Navidrome user
|
|
ansible.posix.authorized_key:
|
|
user: navidrome
|
|
state: present
|
|
key: "{{ lookup('file', '~/.ssh/keys/{{ inventory_hostname }}_navidrome.pub')}}"
|
|
ignore_errors: yes
|
|
|
|
- name: Install Navidrome AUR package
|
|
kewlfft.aur.aur:
|
|
name: navidrome-bin
|
|
state: present
|
|
become_user: aur-build
|
|
|
|
- name: Ensure Navidrome directory is under right owner
|
|
file:
|
|
state: directory
|
|
path: "{{ dataroot }}/navidrome"
|
|
owner: navidrome
|
|
group: navidrome
|
|
recurse: yes
|
|
|
|
- name: Set Navidrome working directory
|
|
lineinfile:
|
|
dest: /usr/lib/systemd/system/navidrome.service
|
|
regexp: "^WorkingDirectory=.*"
|
|
line: "WorkingDirectory={{ dataroot }}/navidrome/"
|
|
notify: Run daemon-reload for Navidrome
|
|
|
|
- name: Set Navidrome home directory
|
|
lineinfile:
|
|
dest: /usr/lib/systemd/system/navidrome.service
|
|
regexp: "^Environment=HOME=.*"
|
|
line: "Environment=HOME={{ dataroot }}/navidrome/"
|
|
notify: Run daemon-reload for Navidrome
|
|
|
|
- name: Allow Navidrome to write in data directory
|
|
lineinfile:
|
|
dest: /usr/lib/systemd/system/navidrome.service
|
|
regexp: "^ReadWritePaths=.*"
|
|
line: "ReadWritePaths={{ dataroot }}/navidrome/"
|
|
notify: Run daemon-reload for Navidrome
|
|
|
|
- name: Configure Navidrome
|
|
template:
|
|
src: navidrome.toml.j2
|
|
dest: /etc/navidrome/navidrome.toml
|
|
notify: Restart Navidrome
|
|
|
|
- name: Start/enable Navidrome
|
|
service:
|
|
name: navidrome
|
|
state: started
|
|
enabled: yes
|