diff --git a/roles/airconnect/defaults/main.yml b/roles/airconnect/defaults/main.yml
index d9a2267..710f734 100644
--- a/roles/airconnect/defaults/main.yml
+++ b/roles/airconnect/defaults/main.yml
@@ -8,6 +8,8 @@ airconnect_group:
name: airconnect
gid: 1337
+
+airconnect_max_volume: "100"
airconnect_upnp: []
airconnect_containers:
# UPnP/Sonos
diff --git a/roles/airconnect/handlers/main.yml b/roles/airconnect/handlers/main.yml
index 9d28fe2..6a26e45 100644
--- a/roles/airconnect/handlers/main.yml
+++ b/roles/airconnect/handlers/main.yml
@@ -2,10 +2,13 @@
- name: restart airconnect containers
docker_container:
- name: airconnect-{{ item }}
+ name: airconnect-{{ item.prog }}
state: "{{ item.state }}"
- restart: item.state == 'started'
+ restart: "{% if item.state|default('started') == 'started' %}true{% else %}false{% endif %}"
+ loop_control:
+ label: "{{ item.prog }}"
with_items: "{{ airconnect_containers }}"
when:
- - airconnect_containers is not defined or not airconnect_containers.changed
- - item.state == 'started'
+ - airconnect_containers is not defined or not airconnect_containers_task.changed
+ - item.state|default("started") == "started"
+ - airconnect_restart_handler|default(true)
diff --git a/roles/airconnect/tasks/airconnect.yml b/roles/airconnect/tasks/airconnect.yml
index 7480ec7..5cf34aa 100644
--- a/roles/airconnect/tasks/airconnect.yml
+++ b/roles/airconnect/tasks/airconnect.yml
@@ -50,7 +50,7 @@
- airconnect
- airconnect-container
- docker-containers
- register: airconnect_containers
+ register: airconnect_containers_task
loop_control:
label: airconnect-{{ item.prog }}
with_items: "{{ airconnect_containers }}"
diff --git a/roles/airconnect/templates/airupnp.xml.j2 b/roles/airconnect/templates/airupnp.xml.j2
index 5b2b84e..9b64590 100644
--- a/roles/airconnect/templates/airupnp.xml.j2
+++ b/roles/airconnect/templates/airupnp.xml.j2
@@ -8,14 +8,14 @@
http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=00;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=0d500000000000000000000000000000
1
- 100
+ {{ airconnect_max_volume }}
-1
1
mp3:320
1
1
- 0:1000
+ 0:500
0
info
@@ -28,9 +28,11 @@
0:0
{% for item in airconnect_upnp -%}
- uuid:{{ item.local_uid }}
+ uuid:{{ item.local_uuid }}
{{ item.name }}
- {{ item.mac }}
+ {% if 'mac' in item -%}
+ {{ item.mac | upper }}
+ {% endif -%}
{% if item.enabled|default(true) %}1{% else %}0{% endif %}
{% endfor %}
diff --git a/roles/homeaudio/files/mopidy-archive-keyring.gpg b/roles/homeaudio/files/mopidy-archive-keyring.gpg
new file mode 100644
index 0000000..2879638
Binary files /dev/null and b/roles/homeaudio/files/mopidy-archive-keyring.gpg differ
diff --git a/roles/homeaudio/tasks/homeaudio.yml b/roles/homeaudio/tasks/homeaudio.yml
new file mode 100644
index 0000000..b85f807
--- /dev/null
+++ b/roles/homeaudio/tasks/homeaudio.yml
@@ -0,0 +1,21 @@
+---
+
+- name: install audio and metadata related packages
+ apt:
+ name:
+ - avahi-utils
+ - id3v2
+ - ffmpeg
+ state: present
+ tags:
+ - homeaudio-packages
+
+- name: install yt-dlp
+ pip:
+ name: yt-dlp
+ state: latest
+ tags:
+ - packages
+ - pip-packages
+ - yt-dlp
+ - homeaudio-packages
diff --git a/roles/homeaudio/tasks/main.yml b/roles/homeaudio/tasks/main.yml
new file mode 100644
index 0000000..b5dd627
--- /dev/null
+++ b/roles/homeaudio/tasks/main.yml
@@ -0,0 +1,7 @@
+---
+
+- import_tasks: homeaudio.yml
+ tags: homeaudio
+
+- import_tasks: mopidy.yml
+ tags: mopidy
diff --git a/roles/homeaudio/tasks/mopidy.yml b/roles/homeaudio/tasks/mopidy.yml
new file mode 100644
index 0000000..7a67aa8
--- /dev/null
+++ b/roles/homeaudio/tasks/mopidy.yml
@@ -0,0 +1,84 @@
+---
+
+- name: copy key for mopidy repo
+ copy:
+ src: mopidy-archive-keyring.gpg
+ dest: /usr/local/share/keyrings/mopidy-archive-keyring.gpg
+ owner: root
+ group: root
+ mode: "0644"
+ tags:
+ - mopidy
+
+- name: add mopidy repo
+ apt_repository:
+ repo: "{{ item }}"
+ state: present
+ update_cache: false
+ filename: /etc/apt/sources.list.d/mopidy
+ with_items:
+ - "deb [signed-by=/usr/local/share/keyrings/mopidy-archive-keyring.gpg] https://apt.mopidy.com/ buster main contrib non-free"
+ - "deb-src [signed-by=/usr/local/share/keyrings/mopidy-archive-keyring.gpg] https://apt.mopidy.com/ buster main contrib non-free"
+ register: mopidy_repo
+ tags:
+ - mopidy
+ - packages
+
+- name: apt-get update if repo changed
+ apt:
+ update_cache: true
+ when: mopidy_repo.changed
+ tags:
+ - mopidy
+ - packages
+
+- name: install mopidy
+ apt:
+ name:
+ - mopidy
+ - mopidy-podcast
+ - mopidy-soundcloud
+ - mopidy-internetarchive
+ - mopidy-local
+ - mopidy-mpd
+ - mopidy-podcast-itunes
+ - mopidy-podcast
+ - mopidy-soundcloud
+ - mopidy-internetarchive
+ - mopidy-local
+ - mopidy-mpd
+ - mopidy-podcast-itunes
+ - mopidy-spotify
+ - mopidy-mpris
+ - upnp-inspector
+ # - playerctl
+ #- upmpdcli
+ state: present
+ tags:
+ - mopidy
+ - packages
+
+- name: install mopidy pip packages
+ pip:
+ name:
+ - Mopidy-Jellyfin
+ - Mopidy-RadioNet
+ - Mopidy-YouTube
+ - Mopidy-Iris
+ - Mopidy-Autoplay
+ state: present
+ tags:
+ - mopidy
+ - packages
+ - pip-packages
+
+- name: template mopdiy config
+ template:
+ src: mopidy.conf.j2
+ dest: /etc/mopidy/mopdy.conf
+ owner: mopidy
+ group: root
+ mode: "0640"
+ tags:
+ - mopidy
+ - mopidy.conf
diff --git a/roles/homeaudio/templates/mopidy.conf.j2 b/roles/homeaudio/templates/mopidy.conf.j2
new file mode 100644
index 0000000..4224a52
--- /dev/null
+++ b/roles/homeaudio/templates/mopidy.conf.j2
@@ -0,0 +1,27 @@
+# For information about configuration values that can be set in this file see:
+#
+# https://docs.mopidy.com/en/latest/config/
+#
+# Run `sudo mopidyctl config` to see the current effective config, based on
+# both defaults and this configuration file.
+[http]
+enabled = true
+hostname = 0.0.0.0
+port = 6680
+zeroconf = Mopidy HTTP server on $hostname
+allowed_origins =
+csrf_protection = true
+default_app = mopidy
+
+[mpd]
+enabled = false
+hostname = 127.0.0.1
+port = 6600
+password =
+max_connections = 20
+connection_timeout = 60
+zeroconf = Mopidy MPD server on $hostname
+command_blacklist =
+ listall
+ listallinfo
+default_playlist_scheme = m3u
diff --git a/roles/owntone/handlers/main.yml b/roles/owntone/handlers/main.yml
index 34e6178..708cd91 100644
--- a/roles/owntone/handlers/main.yml
+++ b/roles/owntone/handlers/main.yml
@@ -7,6 +7,8 @@
- name: restart owntone container
docker_container:
- name: hass
+ name: owntone
state: started
restart: true
+ when:
+ - owntone_restart_handler|default(true)
diff --git a/roles/owntone/tasks/owntone.yml b/roles/owntone/tasks/owntone.yml
index 3bc8cb5..d46ca4c 100644
--- a/roles/owntone/tasks/owntone.yml
+++ b/roles/owntone/tasks/owntone.yml
@@ -10,7 +10,7 @@
tags:
- owntone-dirs
loop_control:
- label: "{{ item.name }}"
+ label: "{{ owntone_path }}/{{ item.name }}"
with_items:
- name: ''
- name: config
@@ -36,6 +36,8 @@
- shairport-metadata.fifo
tags:
- input.fifo
+ # disabled
+ when: false
- name: install certs
copy:
@@ -87,24 +89,6 @@
- cron
- owntone-cron
-- name: install utils for tagging
- apt:
- name:
-
- - id3v2
- - ffmpeg
- state: present
- tags:
- - packages
-
-- name: install yt-dlp
- pip:
- name: yt-dlp
- state: latest
- tags:
- - packages
- - pip-packages
- - yt-dlp
- name: fuse allow other
lineinfile:
diff --git a/roles/owntone/templates/01-owntone.conf.j2 b/roles/owntone/templates/01-owntone.conf.j2
index 559df50..69dff5e 100644
--- a/roles/owntone/templates/01-owntone.conf.j2
+++ b/roles/owntone/templates/01-owntone.conf.j2
@@ -1,5 +1,7 @@
server {
+ listen 444 ssl;
listen 443 ssl http2;
+ # listen 443 ssl http2;
# listen {{ owntone_port_tcp }};
{% if inventory_hostname in wg_clients -%}
@@ -29,12 +31,15 @@ server {
sub_filter_types '*';
sub_filter_once off;
- proxy_pass http://127.0.0.1:{{ owntone_port_tcp }}/;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_pass http://127.0.0.1:{{ owntone_port_tcp }}$request_uri;
proxy_http_version 1.1;
+
+ proxy_set_header Host "{{ owntone_url }}";
+ #proxy_set_header Host "owntone.local:3689";
+
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $remote_addr;
+ proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
diff --git a/roles/owntone/templates/owntone-cron.j2 b/roles/owntone/templates/owntone-cron.j2
index b79dde9..c6c3415 100644
--- a/roles/owntone/templates/owntone-cron.j2
+++ b/roles/owntone/templates/owntone-cron.j2
@@ -2,6 +2,6 @@
# m h dom mon dow
-*/60 * * * * {{ owntone_user.username }} touch {{ owntone_path }}/audio/local_music/trigger.init-rescan
+*/60 * * * * {{ owntone_user.username }} touch {{ owntone_path }}/audio/trigger.init-rescan
#
diff --git a/roles/owntone/templates/owntone.conf.j2 b/roles/owntone/templates/owntone.conf.j2
index 8e0214b..390157a 100644
--- a/roles/owntone/templates/owntone.conf.j2
+++ b/roles/owntone/templates/owntone.conf.j2
@@ -1,12 +1,3 @@
-# A quick guide to configuring OwnTone:
-#
-# For regular use, the most important setting to configure is "directories",
-# which should be the location of your media. Whatever user you have set as
-# "uid" must have read access to this location. If the location is a network
-# mount, please see the README.
-#
-# In all likelihood, that's all you need to do!
-
general {
# Username
# Make sure the user has read access to the library directories you set
@@ -197,7 +188,7 @@ library {
# Watch named pipes in the library for data and autostart playback when
# there is data to be read. To exclude specific pipes from watching,
# consider using the above _ignore options.
- pipe_autostart = true
+ pipe_autostart = false
# Enable automatic rating updates
# If enabled, rating is automatically updated after a song has either been
@@ -208,7 +199,7 @@ library {
# skipcount and a rolling rating based on the current rating and the action
# (played or skipped). Both results are combined with a mix-factor of 0.75:
# new rating = 0.75 * stable rating + 0.25 * rolling rating)
- #rating_updates = false
+ rating_updates = false
# Allows creating, deleting and modifying m3u playlists in the library directories.
# Only supported by the player web interface and some mpd clients
@@ -255,7 +246,7 @@ audio {
# e.g. Airplay. This feature relies on accurate ALSA measurements of
# delay, and some devices dont provide that. If that is the case you
# are better off disabling the feature.
- #sync_disable = false
+ sync_disable = false
# Here you can adjust when local audio is started relative to other
# speakers, e.g. Airplay. Negative values correspond to moving local
@@ -290,10 +281,11 @@ audio {
# Pipe output
# Allows OwnTone to output audio data to a named pipe
-fifo {
- nickname = "fifo"
- path = "/audio/output.fifo"
-}
+# fifo {
+# nickname = "fifo"
+# # placed outside of library
+# path = "/tmp/output.fifo"
+# }
# AirPlay settings common to all devices
#airplay_shared {
@@ -369,6 +361,14 @@ airplay "{{ item.name }}" {
# Name used in the speaker list, overrides name from the device
#nickname = "My speaker name"
# }
+{% for item in owntone_chromecast -%}
+chromecast "{{item.name }}" {
+ exclude = {{ item.exclude|default(false) | lower }}
+ {%- if 'nickname' in item -%}
+ nickname = "{{ item.nickname }}"
+ {% endif +%}
+}
+{% endfor %}
# Spotify settings (only have effect if Spotify enabled - see README/INSTALL)
spotify {