Compare commits

..

5 Commits
1.0.1 ... main

Author SHA1 Message Date
e33b287feb chore(release): 2.0.1 2023-01-24 16:29:49 +01:00
beddb48581 fix: Make docker prefix be same as app. 2023-01-24 16:29:39 +01:00
5fc1a1f8c0 chore(release): 2.0.0 2023-01-22 19:37:04 +01:00
9d870bb96d feat!: Refactor configuration
Docker-config is more flexible.
Configuration is more hierarchical (except paths).
2023-01-22 19:36:10 +01:00
ab2ff91939 Music volume shall be mounted read-only. 2022-09-26 15:40:07 +02:00
15 changed files with 196 additions and 135 deletions

1
.env.yml Normal file
View File

@ -0,0 +1 @@
bonob.enabled: "true"

17
.gitignore vendored
View File

@ -1,7 +1,14 @@
*.retry
*/__pycache__
*.pyc
tests/playbook.retry
tests/.cache
__pycache__
.pytest_cache
.molecule
.cache
.venv
.env.yml
docker-compose.yml
*.iml
.idea
.project
*.pyc
**/.vscode

21
CHANGELOG.md Normal file
View File

@ -0,0 +1,21 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [2.0.1](https://git.laurivan.com/Dev/ansible-role-navidrome/compare/v2.0.0...v2.0.1) (2023-01-24)
### Bug Fixes
* Make docker prefix be same as app. ([beddb48](https://git.laurivan.com/Dev/ansible-role-navidrome/commit/beddb48581242279c5c567edb7b695f0b3cdb5e4))
## 2.0.0 (2023-01-22)
### ⚠ BREAKING CHANGES
* Refactor configuration
### Features
* Refactor configuration ([9d870bb](https://git.laurivan.com/Dev/ansible-role-navidrome/commit/9d870bb96dac32ed76a5143b6af5bbf7f8a50c38))

View File

@ -15,64 +15,64 @@ All variables are listed below (see also `defaults/main.yml`).
You can (and should) specify the version of the navidrome image:
```yaml
navidrome_image_version: 'latest'
navidrome.image_version: 'latest'
```
Navidrome needs a place to store its configuration and another to pick up music from:
```yaml
navidrome_config_volume: '/mnt/config-local/navidrome'
navidrome_music_volume: '/mnt/music'
navidrome.config_volume: '/mnt/config-local/navidrome'
navidrome.music_volume: '/mnt/music'
```
If you have multiple folders with music, you should create a parent and build symbolic links to them.
The web interface is available at the following port:
```yaml
navidrome_host_port: 48533
navidrome.host_port: 48533
```
### Bonob
If you have e.g. a Sonos system in the house, you may install also Bonob by setting `bonob_enabled` to `true`. the default is:
If you have e.g. a Sonos system in the house, you may install also Bonob by setting `bonob.enabled` to `true`. the default is:
```yml
bonob_enabled: false
bonob.enabled: false
```
You can also specify the bonob image version and the port at which is available:
```yml
bonob_image_version: 'latest'
bonob_host_port: 48534
bonob.image_version: 'latest'
bonob.host_port: 48534
```
You can change the colors of the bonob icon displayed:
```yml
bonob_icon_color: "beige"
bonob_icon_background: "red"
bonob.icon_color: "beige"
bonob.icon_background: "red"
```
#### Sonos
The sonos-related variables are:
```yml
bonob_sonos_auto_register: 'true'
bonob_sonos_device_discovery: 'true'
bonob_sonos_seed_host:
bonob_sonos_service_id: "246"
bonob.sonos.auto_register: 'true'
bonob.sonos.device_discovery: 'true'
bonob.sonos.seed_host:
bonob.sonos.service_id: "246"
```
If you try sonos autodiscovery and it doesn't work, please:
1. Find the IP of one of the Sonos devices
2. Set `bonob_sonos_seed_host` to that IP
2. Set `bonob.sonos.seed_host` to that IP
3. Replay the role
You can also add custom clients for streaming:
```yaml
bonob_subsonic_custom_clients: 'audio/flac'
bonob.subsonic.custom_clients: 'audio/flac'
```
For more details, please see the [Bonob documentation](https://github.com/simojenki/bonob).
@ -97,7 +97,7 @@ A list of other roles hosted on Galaxy should go here, plus any details in regar
- name: Example playbook
hosts: services
vars:
bonob_enabled: "true"
bonob.enabled: "true"
roles:
- 'laurivan.navidrome'

View File

@ -1,27 +1,36 @@
---
# defaults file for navidrome
navidrome_image_version: 'latest'
navidrome_config_volume: '/mnt/config-local/navidrome'
navidrome_root_path: /var/local
navidrome_config_volume: "{{ navidrome_root_path }}/config/navidrome"
navidrome_docker_path: "{{ navidrome_root_path }}/docker/navidrome"
navidrome_music_volume: '/mnt/music'
navidrome_host_port: 48533
navidrome_skeleton_paths:
- "{{ navidrome_docker_path }}"
- "{{ navidrome_config_volume }}"
timezone: 'Europe/Brussels'
# Bonob
bonob_enabled: false
bonob_image_version: 'latest'
bonob_host_port: 48534
bonob_icon_color: "beige"
bonob_icon_background: "red"
navidrome:
image_version: 'latest'
host_port: 48533
## Bonob sonos settings
bonob_sonos_auto_register: 'true'
bonob_sonos_device_discovery: 'true'
bonob_sonos_seed_host:
bonob_sonos_service_id: "246"
# Bonob
bonob:
enabled: false
image_version: 'latest'
host_port: 48534
icon_color: "beige"
icon_background: "red"
## Bonob sonos settings
sonos:
auto_register: 'true'
device_discovery: 'true'
seed_host:
service_id: "246"
## Subsonic
bonob_subsonic_custom_clients: 'audio/flac'
subsonic:
custom_clients: 'audio/flac'

46
tasks/config.yml Normal file
View File

@ -0,0 +1,46 @@
---
- name: "NAVIDROME | Set up directories"
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: "0750"
with_items:
- "{{ navidrome_skeleton_paths }}"
tags:
- navidrome.configure
become: true
- name: "NAVIDROME | Write configuration files"
ansible.builtin.template:
src: "navidrome/{{ item }}.j2"
dest: "{{ navidrome_docker_path | expanduser | realpath }}/{{ item }}"
mode: '0640'
loop:
- "docker-compose.yml"
- "env.bonob.conf"
- "env.navidrome.conf"
tags:
- navidrome.configure
- name: "NAVIDROME | Check if the music volume exists"
ansible.builtin.stat:
path: "{{ navidrome_music_volume }}"
register: music
tags:
- navidrome.configure
- name: "NAVIDROME | Set up music volume"
ansible.builtin.file:
state: directory
path: "{{ navidrome_music_volume }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: "0750"
tags:
- navidrome.configure
become: true
when: not music.stat.exists

9
tasks/install.yml Normal file
View File

@ -0,0 +1,9 @@
---
# Deploy navidrome
- name: "NAVIFROME | Ensure navirdome is running"
community.docker.docker_compose:
project_src: "{{ navidrome_docker_path | expanduser | realpath }}"
build: false
become: false

View File

@ -1,54 +1,11 @@
---
# tasks file for navidrome
- name: Set up directories
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: "0750"
with_items:
- "{{ navidrome_config_volume }}"
- "~/navidrome"
- name: "NAVIDROME | Configure"
import_tasks: config.yml
tags:
- configuration
become: true
- navidrome.configure
- name: Check if the music volume exists
ansible.builtin.stat:
path: "{{ navidrome_music_volume }}"
register: music
- name: "NAVIDROME | Install"
import_tasks: install.yml
tags:
- configuration
- name: Set up music volume
ansible.builtin.file:
state: directory
path: "{{ navidrome_music_volume }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: "0750"
tags:
- configuration
become: true
when: not music.stat.exists
- name: Write configuration files
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "~/navidrome/{{ item }}"
mode: '0640'
loop:
- "docker-compose.yml"
- "env.navidrome.conf"
- "env.bonob.conf"
tags:
- configuration
- name: Ensure navirdome is running.
community.docker.docker_compose:
project_src: ~/navidrome/
build: false
become: false
- navidrome.install

View File

@ -1,31 +0,0 @@
version: "3.3"
services:
navidrome:
image: "deluan/navidrome:{{ navidrome_image_version }}"
restart: always
env_file:
- ~/navidrome/env.navidrome.conf
volumes:
- {{ navidrome_config_volume }}:/data
- {{ navidrome_music_volume }}:/music
ports:
- {{ navidrome_host_port }}:4533
networks:
- navidrome
{% if bonob_enabled %}
bonob:
image: simojenki/bonob:{{ bonob_image_version }}
restart: always
depends_on:
- navidrome
env_file:
- ~/navidrome/env.bonob.conf
ports:
- "{{ bonob_host_port }}:3000"
networks:
- navidrome
- default
{% endif %}
networks:
navidrome: {}

View File

@ -1,15 +0,0 @@
{% if bonob_enabled %}
BNB_SONOS_AUTO_REGISTER={{ bonob_sonos_auto_register }}
BNB_SONOS_DEVICE_DISCOVERY={{ bonob_sonos_device_discovery }}
BNB_PORT=3000
{% if bonob_sonos_seed_host %}
BNB_SONOS_SEED_HOST={{ bonob_sonos_seed_host }}
{% endif %}
BNB_SUBSONIC_URL=http://navidrome:4533
BNB_SONOS_SERVICE_ID={{ bonob_sonos_service_id }}
BNB_URL=http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ bonob_host_port }}
BNB_SUBSONIC_CUSTOM_CLIENTS="audio/flac"
BNB_ICON_FOREGROUND_COLOR={{ bonob_icon_color }}
BNB_ICON_BACKGROUND_COLOR={{ bonob_icon_background }}
TZ={{ timezone }}
{% endif %}

View File

@ -1 +0,0 @@
TZ={{timezone}}

View File

@ -0,0 +1,32 @@
version: "3.3"
services:
navidrome:
image: "deluan/navidrome:{{ navidrome.image_version }}"
restart: always
env_file:
- "{{ navidrome_docker_path | expanduser | realpath }}/env.navidrome.conf"
volumes:
- {{ navidrome_config_volume }}:/data
- {{ navidrome_music_volume }}:/music:ro
ports:
- {{ navidrome.host_port }}:4533
networks:
- navidrome
{% if bonob.enabled %}
bonob:
image: simojenki/bonob:{{ bonob.image_version }}
restart: always
depends_on:
- navidrome
env_file:
- "{{ navidrome_docker_path | expanduser | realpath }}/env.bonob.conf"
ports:
- "{{ bonob.host_port }}:3000"
networks:
- navidrome
- default
{% endif %}
networks:
navidrome: {}

View File

@ -0,0 +1,15 @@
{% if bonob.enabled %}
BNB_SONOS_AUTO_REGISTER={{ bonob.sonos.auto_register }}
BNB_SONOS_DEVICE_DISCOVERY={{ bonob.sonos.device_discovery }}
BNB_PORT=3000
{% if bonob.sonos.seed_host %}
BNB_SONOS_SEED_HOST={{ bonob.sonos.seed_host }}
{% endif %}
BNB_SUBSONIC_URL=http://navidrome:4533
BNB_SONOS_SERVICE_ID={{ bonob.sonos.service_id }}
BNB_URL=http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ bonob.host_port }}
BNB_SUBSONIC_CUSTOM_CLIENTS="audio/flac"
BNB_ICON_FOREGROUND_COLOR={{ bonob.icon_color }}
BNB_ICON_BACKGROUND_COLOR={{ bonob.icon_background }}
TZ={{ timezone }}
{% endif %}

View File

@ -0,0 +1,5 @@
TZ={{timezone}}
ND_ENABLETRANSCODINGCONFIG=true
ND_SCANSCHEDULE=1h
ND_LOGLEVEL=info
ND_SESSIONTIMEOUT=24h

6
test-requirements.txt Normal file
View File

@ -0,0 +1,6 @@
ansible==5.2.0
molecule==3.4.0
docker==5.0.0
molecule-docker==0.2.4
ansible-lint==5.3.2
yamllint==1.28.0