This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
homeserver-ansible/roles/services/navidrome/tasks/main.yml

105 lines
2.3 KiB
YAML

- name: Install necessary packages for beets
community.general.pacman:
name:
- beets
- python-pylast
- python-httpx
- yt-dlp
state: present
- name: Create Navidrome user
user:
name: navidrome
home: "{{ dataroot }}/navidrome"
create_home: no
- name: Ensure .config exists
file:
path: "/home/{{ username }}/.config/"
state: directory
owner: "{{ username }}"
group: "{{ username }}"
recurse: yes
- name: Ensure beets configuration folder exists
file:
path: "/home/{{ username }}/.config/beets/"
state: directory
owner: "{{ username }}"
group: "{{ username }}"
- name: Deploy beets configuration file
template:
src: beets_config.yaml.j2
dest: "/home/{{ username }}/.config/beets/config.yaml"
- name: Install Navidrome AUR package
kewlfft.aur.aur:
name: navidrome-bin
state: present
become_user: aur-build
- name: Create music group
group:
name: mus
state: present
- name: Add user to music group
user:
name: "{{ username }}"
append: yes
groups: mus
- name: Set Navidrome directory permissions
file:
state: directory
path: "{{ dataroot }}/navidrome"
owner: navidrome
group: mus
mode: u=rwX,g=rwX,o=rX
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: Create systemd override dir
file:
path: /etc/systemd/system/navidrome.service.d/
state: directory
owner: root
group: root
mode: 0755
- name: Deploy systemd override conf
template:
src: navidrome.service.j2
dest: /etc/systemd/system/navidrome.service.d/override.conf
owner: root
group: root
mode: 0644
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