Add beets to navidrome role

This commit is contained in:
dogeystamp 2022-05-10 22:10:09 -04:00
parent 219cfb6e78
commit 0c9429d6d8
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 50 additions and 8 deletions

View File

@ -1,15 +1,37 @@
- name: Install necessary packages for beets
community.general.pacman:
name:
- beets
- python-pylast
- python-httpx
- yt-dlp
state: present
- name: Create Navidrome user - name: Create Navidrome user
user: user:
name: navidrome name: navidrome
home: "{{ dataroot }}/navidrome" home: "{{ dataroot }}/navidrome"
create_home: no create_home: no
- name: Deploy SSH key for Navidrome user - name: Ensure .config exists
ansible.posix.authorized_key: file:
user: navidrome path: "/home/{{ username }}/.config/"
state: present state: directory
key: "{{ lookup('file', '~/.ssh/keys/{{ inventory_hostname }}_navidrome.pub')}}" owner: "{{ username }}"
ignore_errors: yes 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 - name: Install Navidrome AUR package
kewlfft.aur.aur: kewlfft.aur.aur:
@ -17,12 +39,24 @@
state: present state: present
become_user: aur-build become_user: aur-build
- name: Ensure Navidrome directory is under right owner - 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: file:
state: directory state: directory
path: "{{ dataroot }}/navidrome" path: "{{ dataroot }}/navidrome"
owner: navidrome owner: navidrome
group: navidrome group: mus
mode: u=rwX,g=rwX,o=-rwx
recurse: yes recurse: yes
- name: Set Navidrome working directory - name: Set Navidrome working directory

View File

@ -0,0 +1,8 @@
directory: {{ dataroot }}/navidrome/mus
library: {{ dataroot }}/navidrome/beetslib.db
plugins: fetchart lastgenre
lastgenre:
auto: yes
canonical: yes