feat!: Refactor configuration
Docker-config is more flexible. Configuration is more hierarchical (except paths).
This commit is contained in:
parent
ab2ff91939
commit
9d870bb96d
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,7 +1,14 @@
|
|||||||
*.retry
|
tests/playbook.retry
|
||||||
*/__pycache__
|
tests/.cache
|
||||||
*.pyc
|
__pycache__
|
||||||
|
.pytest_cache
|
||||||
|
.molecule
|
||||||
.cache
|
.cache
|
||||||
.venv
|
.venv
|
||||||
.env.yml
|
|
||||||
docker-compose.yml
|
*.iml
|
||||||
|
.idea
|
||||||
|
.project
|
||||||
|
|
||||||
|
*.pyc
|
||||||
|
**/.vscode
|
||||||
|
34
README.md
34
README.md
@ -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:
|
You can (and should) specify the version of the navidrome image:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
navidrome_image_version: 'latest'
|
navidrome.image_version: 'latest'
|
||||||
```
|
```
|
||||||
|
|
||||||
Navidrome needs a place to store its configuration and another to pick up music from:
|
Navidrome needs a place to store its configuration and another to pick up music from:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
navidrome_config_volume: '/mnt/config-local/navidrome'
|
navidrome.config_volume: '/mnt/config-local/navidrome'
|
||||||
navidrome_music_volume: '/mnt/music'
|
navidrome.music_volume: '/mnt/music'
|
||||||
```
|
```
|
||||||
If you have multiple folders with music, you should create a parent and build symbolic links to them.
|
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:
|
The web interface is available at the following port:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
navidrome_host_port: 48533
|
navidrome.host_port: 48533
|
||||||
```
|
```
|
||||||
|
|
||||||
### Bonob
|
### 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
|
```yml
|
||||||
bonob_enabled: false
|
bonob.enabled: false
|
||||||
```
|
```
|
||||||
You can also specify the bonob image version and the port at which is available:
|
You can also specify the bonob image version and the port at which is available:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
bonob_image_version: 'latest'
|
bonob.image_version: 'latest'
|
||||||
bonob_host_port: 48534
|
bonob.host_port: 48534
|
||||||
```
|
```
|
||||||
|
|
||||||
You can change the colors of the bonob icon displayed:
|
You can change the colors of the bonob icon displayed:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
bonob_icon_color: "beige"
|
bonob.icon_color: "beige"
|
||||||
bonob_icon_background: "red"
|
bonob.icon_background: "red"
|
||||||
```
|
```
|
||||||
#### Sonos
|
#### Sonos
|
||||||
|
|
||||||
The sonos-related variables are:
|
The sonos-related variables are:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
bonob_sonos_auto_register: 'true'
|
bonob.sonos.auto_register: 'true'
|
||||||
bonob_sonos_device_discovery: 'true'
|
bonob.sonos.device_discovery: 'true'
|
||||||
bonob_sonos_seed_host:
|
bonob.sonos.seed_host:
|
||||||
bonob_sonos_service_id: "246"
|
bonob.sonos.service_id: "246"
|
||||||
```
|
```
|
||||||
|
|
||||||
If you try sonos autodiscovery and it doesn't work, please:
|
If you try sonos autodiscovery and it doesn't work, please:
|
||||||
|
|
||||||
1. Find the IP of one of the Sonos devices
|
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
|
3. Replay the role
|
||||||
|
|
||||||
You can also add custom clients for streaming:
|
You can also add custom clients for streaming:
|
||||||
|
|
||||||
```yaml
|
```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).
|
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
|
- name: Example playbook
|
||||||
hosts: services
|
hosts: services
|
||||||
vars:
|
vars:
|
||||||
bonob_enabled: "true"
|
bonob.enabled: "true"
|
||||||
roles:
|
roles:
|
||||||
- 'laurivan.navidrome'
|
- 'laurivan.navidrome'
|
||||||
|
|
||||||
|
@ -1,27 +1,37 @@
|
|||||||
---
|
---
|
||||||
# defaults file for navidrome
|
# defaults file for navidrome
|
||||||
|
|
||||||
navidrome_image_version: 'latest'
|
navidrome_root_path: /var/local/navidrome
|
||||||
|
navidrome_config_volume: "{{ navidrome_root_path }}/config"
|
||||||
navidrome_config_volume: '/mnt/config-local/navidrome'
|
navidrome_docker_path: "{{ navidrome_root_path }}/docker"
|
||||||
navidrome_music_volume: '/mnt/music'
|
navidrome_music_volume: '/mnt/music'
|
||||||
|
|
||||||
navidrome_host_port: 48533
|
navidrome_skeleton_paths:
|
||||||
|
- "{{ navidrome_docker_path }}"
|
||||||
|
- "{{ navidrome_config_volume }}"
|
||||||
|
|
||||||
timezone: 'Europe/Brussels'
|
timezone: 'Europe/Brussels'
|
||||||
|
|
||||||
|
navidrome:
|
||||||
|
image_version: 'latest'
|
||||||
|
host_port: 48533
|
||||||
|
|
||||||
|
|
||||||
# Bonob
|
# Bonob
|
||||||
bonob_enabled: false
|
bonob:
|
||||||
bonob_image_version: 'latest'
|
enabled: false
|
||||||
bonob_host_port: 48534
|
image_version: 'latest'
|
||||||
bonob_icon_color: "beige"
|
host_port: 48534
|
||||||
bonob_icon_background: "red"
|
icon_color: "beige"
|
||||||
|
icon_background: "red"
|
||||||
|
|
||||||
## Bonob sonos settings
|
## Bonob sonos settings
|
||||||
bonob_sonos_auto_register: 'true'
|
sonos:
|
||||||
bonob_sonos_device_discovery: 'true'
|
auto_register: 'true'
|
||||||
bonob_sonos_seed_host:
|
device_discovery: 'true'
|
||||||
bonob_sonos_service_id: "246"
|
seed_host:
|
||||||
|
service_id: "246"
|
||||||
|
|
||||||
## Subsonic
|
## Subsonic
|
||||||
bonob_subsonic_custom_clients: 'audio/flac'
|
subsonic:
|
||||||
|
custom_clients: 'audio/flac'
|
||||||
|
46
tasks/config.yml
Normal file
46
tasks/config.yml
Normal 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
9
tasks/install.yml
Normal 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
|
@ -1,54 +1,11 @@
|
|||||||
---
|
---
|
||||||
# tasks file for navidrome
|
|
||||||
|
|
||||||
- name: Set up directories
|
- name: "NAVIDROME | Configure"
|
||||||
ansible.builtin.file:
|
import_tasks: config.yml
|
||||||
state: directory
|
|
||||||
path: "{{ item }}"
|
|
||||||
owner: "{{ ansible_effective_user_id }}"
|
|
||||||
group: "{{ ansible_effective_group_id }}"
|
|
||||||
mode: "0750"
|
|
||||||
with_items:
|
|
||||||
- "{{ navidrome_config_volume }}"
|
|
||||||
- "~/navidrome"
|
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- navidrome.configure
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Check if the music volume exists
|
- name: "NAVIDROME | Install"
|
||||||
ansible.builtin.stat:
|
import_tasks: install.yml
|
||||||
path: "{{ navidrome_music_volume }}"
|
|
||||||
register: music
|
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- navidrome.install
|
||||||
|
|
||||||
- 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
|
|
||||||
|
@ -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 %}
|
|
@ -1 +0,0 @@
|
|||||||
TZ={{timezone}}
|
|
@ -1,27 +1,28 @@
|
|||||||
version: "3.3"
|
version: "3.3"
|
||||||
services:
|
services:
|
||||||
navidrome:
|
navidrome:
|
||||||
image: "deluan/navidrome:{{ navidrome_image_version }}"
|
image: "deluan/navidrome:{{ navidrome.image_version }}"
|
||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- ~/navidrome/env.navidrome.conf
|
- "{{ navidrome_docker_path | expanduser | realpath }}/env.navidrome.conf"
|
||||||
volumes:
|
volumes:
|
||||||
- {{ navidrome_config_volume }}:/data
|
- {{ navidrome_config_volume }}:/data
|
||||||
- {{ navidrome_music_volume }}:/music:ro
|
- {{ navidrome_music_volume }}:/music:ro
|
||||||
ports:
|
ports:
|
||||||
- {{ navidrome_host_port }}:4533
|
- {{ navidrome.host_port }}:4533
|
||||||
networks:
|
networks:
|
||||||
- navidrome
|
- navidrome
|
||||||
{% if bonob_enabled %}
|
|
||||||
|
{% if bonob.enabled %}
|
||||||
bonob:
|
bonob:
|
||||||
image: simojenki/bonob:{{ bonob_image_version }}
|
image: simojenki/bonob:{{ bonob.image_version }}
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- navidrome
|
- navidrome
|
||||||
env_file:
|
env_file:
|
||||||
- ~/navidrome/env.bonob.conf
|
- "{{ navidrome_docker_path | expanduser | realpath }}/env.bonob.conf"
|
||||||
ports:
|
ports:
|
||||||
- "{{ bonob_host_port }}:3000"
|
- "{{ bonob.host_port }}:3000"
|
||||||
networks:
|
networks:
|
||||||
- navidrome
|
- navidrome
|
||||||
- default
|
- default
|
15
templates/navidrome/env.bonob.conf.j2
Normal file
15
templates/navidrome/env.bonob.conf.j2
Normal 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 %}
|
5
templates/navidrome/env.navidrome.conf.j2
Normal file
5
templates/navidrome/env.navidrome.conf.j2
Normal 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
6
test-requirements.txt
Normal 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
|
Loading…
Reference in New Issue
Block a user