Initial commit
All checks were successful
/ ansible-docsmith (push) Successful in 41s

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2026-03-23 10:48:41 +01:00 committed by Julien Riou
commit f418990e84
Signed by: jriou
GPG key ID: 9A099EDA51316854
85 changed files with 3520 additions and 2 deletions

1
roles/navidrome/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
venv

221
roles/navidrome/README.md Normal file
View file

@ -0,0 +1,221 @@
# Ansible Role Navidrome
Ansible role to manage a [Navidrome](https://github.com/navidrome/navidrome) instance.
## Table of Content
<!-- ANSIBLE DOCSMITH TOC START -->
* [Role variables](#variables)
* [`navidrome_version`](#variable-navidrome_version)
* [`navidrome_arch`](#variable-navidrome_arch)
* [`navidrome_user`](#variable-navidrome_user)
* [`navidrome_group`](#variable-navidrome_group)
* [`navidrome_music_folder`](#variable-navidrome_music_folder)
* [`navidrome_data_folder`](#variable-navidrome_data_folder)
* [`navidrome_cache_folder`](#variable-navidrome_cache_folder)
* [`navidrome_manage_iptables`](#variable-navidrome_manage_iptables)
* [`navidrome_allowed_sources`](#variable-navidrome_allowed_sources)
* [`navidrome_address`](#variable-navidrome_address)
* [`navidrome_port`](#variable-navidrome_port)
* [`navidrome_enable_insights_collector`](#variable-navidrome_enable_insights_collector)
* [`navidrome_base_url`](#variable-navidrome_base_url)
<!-- ANSIBLE DOCSMITH TOC END -->
<!-- ANSIBLE DOCSMITH MAIN START -->
## Role variables<a id="variables"></a>
The following variables can be configured for this role:
| Variable | Type | Required | Default | Description (abstract) |
|----------|------|----------|---------|------------------------|
| `navidrome_version` | `str` | No | `"0.54.5"` | Version of the debian package. |
| `navidrome_arch` | `str` | No | `"amd64"` | Architecture of the debian package. |
| `navidrome_user` | `str` | No | `"navidrome"` | Operating system user to run the service. |
| `navidrome_group` | `str` | No | `"navidrome"` | Operating system group to run the service. |
| `navidrome_music_folder` | `path` | No | `"/opt/navidrome/music"` | Path to the music folder. |
| `navidrome_data_folder` | `path` | No | `"/var/lib/navidrome"` | Path to the data directory. |
| `navidrome_cache_folder` | `path` | No | `"{{ navidrome_data_folder }}/cache"` | Path to the cache folder. |
| `navidrome_manage_iptables` | `bool` | No | `false` | Configure iptables rules |
| `navidrome_allowed_sources` | `list` | No | N/A | List of IP ranges to allow when `navidrome_manage_iptables` is enabled |
| `navidrome_address` | `str` | No | `"localhost"` | Address to listen. |
| `navidrome_port` | `int` | No | `4533` | Port to listen |
| `navidrome_enable_insights_collector` | `bool` | No | `false` | Enable the insights collector. |
| `navidrome_base_url` | `str` | No | N/A | Base URL of the web interface. |
### `navidrome_version`<a id="variable-navidrome_version"></a>
[*⇑ Back to ToC ⇑*](#toc)
Version of the debian package.
- **Type**: `str`
- **Required**: No
- **Default**: `"0.54.5"`
### `navidrome_arch`<a id="variable-navidrome_arch"></a>
[*⇑ Back to ToC ⇑*](#toc)
Architecture of the debian package.
- **Type**: `str`
- **Required**: No
- **Default**: `"amd64"`
### `navidrome_user`<a id="variable-navidrome_user"></a>
[*⇑ Back to ToC ⇑*](#toc)
Operating system user to run the service.
- **Type**: `str`
- **Required**: No
- **Default**: `"navidrome"`
### `navidrome_group`<a id="variable-navidrome_group"></a>
[*⇑ Back to ToC ⇑*](#toc)
Operating system group to run the service.
- **Type**: `str`
- **Required**: No
- **Default**: `"navidrome"`
### `navidrome_music_folder`<a id="variable-navidrome_music_folder"></a>
[*⇑ Back to ToC ⇑*](#toc)
Path to the music folder.
- **Type**: `path`
- **Required**: No
- **Default**: `"/opt/navidrome/music"`
### `navidrome_data_folder`<a id="variable-navidrome_data_folder"></a>
[*⇑ Back to ToC ⇑*](#toc)
Path to the data directory.
- **Type**: `path`
- **Required**: No
- **Default**: `"/var/lib/navidrome"`
### `navidrome_cache_folder`<a id="variable-navidrome_cache_folder"></a>
[*⇑ Back to ToC ⇑*](#toc)
Path to the cache folder.
- **Type**: `path`
- **Required**: No
- **Default**: `"{{ navidrome_data_folder }}/cache"`
### `navidrome_manage_iptables`<a id="variable-navidrome_manage_iptables"></a>
[*⇑ Back to ToC ⇑*](#toc)
Configure iptables rules
- **Type**: `bool`
- **Required**: No
- **Default**: `false`
### `navidrome_allowed_sources`<a id="variable-navidrome_allowed_sources"></a>
[*⇑ Back to ToC ⇑*](#toc)
List of IP ranges to allow when `navidrome_manage_iptables` is enabled
- **Type**: `list`
- **Required**: No
### `navidrome_address`<a id="variable-navidrome_address"></a>
[*⇑ Back to ToC ⇑*](#toc)
Address to listen.
- **Type**: `str`
- **Required**: No
- **Default**: `"localhost"`
### `navidrome_port`<a id="variable-navidrome_port"></a>
[*⇑ Back to ToC ⇑*](#toc)
Port to listen
- **Type**: `int`
- **Required**: No
- **Default**: `4533`
### `navidrome_enable_insights_collector`<a id="variable-navidrome_enable_insights_collector"></a>
[*⇑ Back to ToC ⇑*](#toc)
Enable the insights collector.
- **Type**: `bool`
- **Required**: No
- **Default**: `false`
### `navidrome_base_url`<a id="variable-navidrome_base_url"></a>
[*⇑ Back to ToC ⇑*](#toc)
Base URL of the web interface.
- **Type**: `str`
- **Required**: No
<!-- ANSIBLE DOCSMITH MAIN END -->
## Usage
Playbook example:
```yaml
- hosts: all
roles:
- jriou.general.navidrome
```
Then run the playbook:
```
ansible-playbook play.yml
```
## Donate
As we all love FOSS, you should consider sponsoring the
[Navidrome](https://github.com/navidrome/navidrome) project.

View file

@ -0,0 +1,84 @@
---
# Version of the debian package.
#
# - Type: str
# - Required: No
# - Default: 0.54.5
navidrome_version: 0.54.5
# Architecture of the debian package.
#
# - Type: str
# - Required: No
# - Default: amd64
navidrome_arch: amd64
# Operating system user to run the service.
#
# - Type: str
# - Required: No
# - Default: navidrome
navidrome_user: navidrome
# Operating system group to run the service.
#
# - Type: str
# - Required: No
# - Default: navidrome
navidrome_group: navidrome
# Path to the music folder.
#
# - Type: path
# - Required: No
# - Default: /opt/navidrome/music
navidrome_music_folder: /opt/navidrome/music
# Path to the data directory.
#
# - Type: path
# - Required: No
# - Default: /var/lib/navidrome
navidrome_data_folder: /var/lib/navidrome
# Path to the cache folder.
#
# - Type: path
# - Required: No
# - Default: {{ navidrome_data_folder }}/cache
navidrome_cache_folder: "{{ navidrome_data_folder }}/cache"
# Configure iptables rules
#
# - Type: bool
# - Required: No
# - Default: false
navidrome_manage_iptables: false
# List of IP ranges to allow when `navidrome_manage_iptables` is enabled
#
# - Type: list
# - Required: No
navidrome_allowed_sources: []
# Address to listen.
#
# - Type: str
# - Required: No
# - Default: localhost
navidrome_address: localhost
# Port to listen
#
# - Type: int
# - Required: No
# - Default: 4533
navidrome_port: 4533
# Enable the insights collector.
#
# - Type: bool
# - Required: No
# - Default: false
navidrome_enable_insights_collector: false

View file

@ -0,0 +1,14 @@
---
- name: Reload systemd
ansible.builtin.systemd_service:
daemon_reload: true
- name: Restart navidrome
ansible.builtin.service:
name: navidrome
state: restarted
- name: Save iptables
ansible.builtin.command:
cmd: netfilter-persistent save
changed_when: true

View file

@ -0,0 +1,78 @@
---
argument_specs:
main:
short_description: Install Navidrome.
description:
- Install [Navidrome](https://github.com/navidrome/navidrome).
author:
- jriou
options:
navidrome_version:
description:
- Version of the debian package.
default: 0.54.5
navidrome_arch:
description:
- Architecture of the debian package.
default: amd64
navidrome_user:
description:
- Operating system user to run the service.
default: navidrome
navidrome_group:
description:
- Operating system group to run the service.
default: navidrome
navidrome_music_folder:
description:
- Path to the music folder.
type: path
default: /opt/navidrome/music
navidrome_data_folder:
description:
- Path to the data directory.
type: path
default: /var/lib/navidrome
navidrome_cache_folder:
description:
- Path to the cache folder.
type: path
default: "{{ navidrome_data_folder }}/cache"
navidrome_manage_iptables:
description:
- Configure iptables rules
type: bool
default: false
navidrome_allowed_sources:
description:
- List of IP ranges to allow when `navidrome_manage_iptables` is enabled
type: list
navidrome_address:
description:
- Address to listen.
default: localhost
navidrome_port:
description:
- Port to listen
type: int
default: 4533
navidrome_enable_insights_collector:
description:
- Enable the insights collector.
type: bool
default: false
navidrome_base_url:
description:
- Base URL of the web interface.

View file

@ -0,0 +1,62 @@
---
- name: Install package
ansible.builtin.apt:
deb: "https://github.com/navidrome/navidrome/releases/download/v{{ navidrome_version }}/navidrome_{{ navidrome_version }}_linux_{{ navidrome_arch }}.deb"
- name: Create directories
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: "{{ navidrome_user }}"
group: "{{ navidrome_group }}"
mode: "0755"
loop:
- "{{ navidrome_music_folder }}"
- "{{ navidrome_data_folder }}"
- "{{ navidrome_cache_folder }}"
- name: Create configuration file
ansible.builtin.template:
src: navidrome.toml.j2
dest: /etc/navidrome/navidrome.toml
owner: "{{ navidrome_user }}"
group: "{{ navidrome_group }}"
mode: "0644"
notify:
- Restart navidrome
- name: Create systemd override directory
ansible.builtin.file:
state: directory
path: /etc/systemd/system/navidrome.service.d
owner: root
group: root
mode: "0755"
- name: Add systemd override
ansible.builtin.template:
src: override.conf.j2
dest: /etc/systemd/system/navidrome.service.d/override.conf
owner: root
group: root
mode: "0755"
notify:
- Reload systemd
- Restart navidrome
- name: Start service
ansible.builtin.service:
name: navidrome
state: started
- name: Manage iptables
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
source: "{{ item }}"
destination_port: "{{ navidrome_port }}"
jump: ACCEPT
comment: navidrome
loop: "{{ navidrome_allowed_sources }}"
notify: Save iptables
when: navidrome_manage_iptables

View file

@ -0,0 +1,10 @@
{{ ansible_managed | comment }}
MusicFolder = "{{ navidrome_music_folder }}"
DataFolder = "{{ navidrome_data_folder }}"
CacheFolder = "{{ navidrome_cache_folder }}"
Address = "{{ navidrome_address }}"
Port = "{{ navidrome_port }}"
EnableInsightsCollector = "{{ navidrome_enable_insights_collector }}"
{% if navidrome_base_url is defined %}
BaseUrl = "{{ navidrome_base_url }}"
{% endif %}

View file

@ -0,0 +1,5 @@
{{ ansible_managed | comment }}
[Service]
User={{ navidrome_user }}
WorkingDirectory={{ navidrome_data_folder }}
ReadWritePaths={{ navidrome_data_folder }}