summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/kodi/config/defaults/main.yml27
-rw-r--r--roles/kodi/config/tasks/main.yml55
-rw-r--r--roles/kodi/config/templates/sources.xml.j214
-rw-r--r--roles/kodi/standalone/templates/kodi.service.j22
-rwxr-xr-xroles/ws/minet/templates/connections/horstWireless.j24
5 files changed, 99 insertions, 3 deletions
diff --git a/roles/kodi/config/defaults/main.yml b/roles/kodi/config/defaults/main.yml
new file mode 100644
index 00000000..54e6cfa7
--- /dev/null
+++ b/roles/kodi/config/defaults/main.yml
@@ -0,0 +1,27 @@
+---
+kodi_config_nfs4_mounts: {}
+
+# kodi_config_nfs4_mounts:
+# - src: 192.0.2.0:/
+# path: /srv/files
+
+
+kodi_config_guisettings: {}
+
+# kodi_config_guisettings:
+# locale.keyboardlayouts: "German ABC|German QWERTZ"
+# locale.activekeyboardlayout: "German QWERTZ"
+# locale.country: Central Europe
+# locale.timezonecountry: Austria
+# locale.timezone: Europa Vienna
+# services.devicename: "Kodi @ {{ host_name }}"
+
+
+kodi_config_sources: {}
+
+# kodi_config_sources:
+# video:
+# - name: Series
+# path: /srv/files/series
+# - name: Movies
+# path: /srv/files/movies
diff --git a/roles/kodi/config/tasks/main.yml b/roles/kodi/config/tasks/main.yml
new file mode 100644
index 00000000..4bfa2f5c
--- /dev/null
+++ b/roles/kodi/config/tasks/main.yml
@@ -0,0 +1,55 @@
+---
+ ## Kodi only supports NFSv3, however it will probably work with Kodi 20+ (https://github.com/xbmc/xbmc/pull/21659)
+- name: mount NFSv4 volumes
+ loop: "{{ kodi_config_nfs4_mounts }}"
+ loop_control:
+ label: "{{ item.src }} -> {{ item.path }}"
+ mount:
+ src: "{{ item.src }}"
+ path: "{{ item.path }}"
+ fstype: nfs4
+ opts: nodev,x-systemd.automount,nofail,ro
+ state: mounted
+
+- name: install python lxml
+ apt:
+ name: "{{ python_basename }}-lxml"
+ state: present
+
+- name: stop kodi
+ systemd:
+ name: kodi.service
+ state: stopped
+
+ ## https://github.com/jose1711/kodi-ansible-role
+- name: configure guisettings.xml
+ loop: "{{ kodi_config_guisettings | dict2items }}"
+ loop_control:
+ label: "{{ item.key }} = {{ item.value }}"
+ xml:
+ path: /home/kodi/.kodi/userdata/guisettings.xml
+ xpath: '/settings/setting[@id="{{ item.key }}"]'
+ value: "{{ item.value }}"
+ pretty_print: yes
+
+- name: configure guisettings.xml - remove defaults
+ loop: "{{ kodi_config_guisettings | dict2items }}"
+ loop_control:
+ label: "{{ item.key }} = {{ item.value }}"
+ xml:
+ path: /home/kodi/.kodi/userdata/guisettings.xml
+ xpath: '/settings/setting[@id="{{ item.key }}"]/@default'
+ state: absent
+ pretty_print: yes
+
+- name: generate sources.xml
+ template:
+ src: sources.xml.j2
+ dest: /home/kodi/.kodi/userdata/sources.xml
+ owner: kodi
+ group: kodi
+
+- name: start kodi
+ systemd:
+ name: kodi.service
+ state: started
diff --git a/roles/kodi/config/templates/sources.xml.j2 b/roles/kodi/config/templates/sources.xml.j2
new file mode 100644
index 00000000..0ae09b74
--- /dev/null
+++ b/roles/kodi/config/templates/sources.xml.j2
@@ -0,0 +1,14 @@
+<sources>
+{% for source_type in ['programs', 'video', 'music', 'pictures', 'files', 'games'] %}
+ <{{ source_type }}>
+ <default pathversion="1"></default>
+{% for source in kodi_config_sources[source_type] | default([]) %}
+ <source>
+ <name>{{ source.name }}</name>
+ <path pathversion="1">{{ source.path }}</path>
+ <allowsharing>true</allowsharing>
+ </source>
+{% endfor %}
+ </{{ source_type }}>
+{% endfor %}
+</sources>
diff --git a/roles/kodi/standalone/templates/kodi.service.j2 b/roles/kodi/standalone/templates/kodi.service.j2
index c349010e..62d85831 100644
--- a/roles/kodi/standalone/templates/kodi.service.j2
+++ b/roles/kodi/standalone/templates/kodi.service.j2
@@ -1,6 +1,6 @@
[Unit]
Description=Kodi standalone (GBM)
-After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
+After=remote-fs.target network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service
diff --git a/roles/ws/minet/templates/connections/horstWireless.j2 b/roles/ws/minet/templates/connections/horstWireless.j2
index c6d04b7e..648c407a 100755
--- a/roles/ws/minet/templates/connections/horstWireless.j2
+++ b/roles/ws/minet/templates/connections/horstWireless.j2
@@ -10,8 +10,8 @@ MODULE_NAME="{{ ws_minet_wireless_interface_module }}"
case "$1" in
start|"")
echo "Connecting with $DESC_NAME"
- activate_interface wlan0 $MODULE_NAME
- iw dev wlan0 del
+ activate_interface "{{ ws_minet_wireless_interface_name }}" $MODULE_NAME
+ iw dev "{{ ws_minet_wireless_interface_name }}" del
iw phy phy0 interface add $INTERFACE type monitor
xfce4-terminal --maximize -x horst -i $INTERFACE
;;