Add Navidrome role
This commit is contained in:
parent
8d9f60fbdd
commit
219cfb6e78
@ -16,6 +16,7 @@ This project was largely inspired by his own [infra](https://github.com/notthebe
|
||||
* Matrix Synapse
|
||||
* Nginx webserver
|
||||
* MediaWiki farm
|
||||
* Navidrome music server
|
||||
* SFTP (not really a service, included in sshd)
|
||||
* Firewall (UFW)
|
||||
|
||||
|
9
roles/services/navidrome/handlers/main.yml
Normal file
9
roles/services/navidrome/handlers/main.yml
Normal file
@ -0,0 +1,9 @@
|
||||
- name: Run daemon-reload for Navidrome
|
||||
systemd:
|
||||
name: navidrome
|
||||
daemon-reload: yes
|
||||
|
||||
- name: Restart Navidrome
|
||||
service:
|
||||
name: navidrome
|
||||
state: restarted
|
59
roles/services/navidrome/tasks/main.yml
Normal file
59
roles/services/navidrome/tasks/main.yml
Normal file
@ -0,0 +1,59 @@
|
||||
- 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
|
2
roles/services/navidrome/templates/navidrome.toml.j2
Normal file
2
roles/services/navidrome/templates/navidrome.toml.j2
Normal file
@ -0,0 +1,2 @@
|
||||
MusicFolder = "{{ dataroot }}/navidrome/mus/"
|
||||
BaseUrl = "/mus"
|
@ -68,6 +68,10 @@ http { include mime.types;
|
||||
proxy_pass http://localhost:3000/ ;
|
||||
}
|
||||
|
||||
location /mus/ {
|
||||
proxy_pass http://localhost:4533/mus/ ;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
# 404
|
||||
try_files $fastcgi_script_name =404;
|
||||
|
Reference in New Issue
Block a user