diff options
-rw-r--r-- | chaos-at-home/ch-cm4-test.yml | 9 | ||||
-rw-r--r-- | chaos-at-home/ch-mcbr.yml | 13 | ||||
-rw-r--r-- | inventory/host_vars/ch-cm4-test.yml | 22 | ||||
-rw-r--r-- | inventory/host_vars/ch-mcbr.yml | 22 | ||||
-rw-r--r-- | roles/kodi/config/defaults/main.yml | 27 | ||||
-rw-r--r-- | roles/kodi/config/tasks/main.yml | 54 | ||||
-rw-r--r-- | roles/kodi/config/templates/sources.xml.j2 | 14 |
7 files changed, 141 insertions, 20 deletions
diff --git a/chaos-at-home/ch-cm4-test.yml b/chaos-at-home/ch-cm4-test.yml index 2726fc07..599fe561 100644 --- a/chaos-at-home/ch-cm4-test.yml +++ b/chaos-at-home/ch-cm4-test.yml @@ -12,11 +12,4 @@ hosts: ch-cm4-test roles: - role: kodi/standalone - post_tasks: - - name: mount fileserver volumes - mount: - src: "{{ network_zones.lan.prefix | ansible.utils.ipaddr(network_zones.lan.offsets['ch-prometheus']) | ansible.utils.ipaddr('address') }}:/" - path: /srv/files - fstype: nfs4 - opts: nodev,x-systemd.automount,nofail,ro - state: mounted + - role: kodi/config diff --git a/chaos-at-home/ch-mcbr.yml b/chaos-at-home/ch-mcbr.yml index e2227b41..3fa66eef 100644 --- a/chaos-at-home/ch-mcbr.yml +++ b/chaos-at-home/ch-mcbr.yml @@ -13,15 +13,4 @@ hosts: ch-mcbr roles: - role: kodi/standalone - ## TODO: - ## - https://kodi.wiki/view/Kore_Manual - ## - https://kodi.wiki/view/MySQL/Setting_up_Kodi (need to wait for NFSv4 support ...) - post_tasks: - ## Kodi only supports NFSv3, however it will probably work with Kodi 20+ (https://github.com/xbmc/xbmc/pull/21659) - - name: mount fileserver volumes - mount: - src: "{{ network_zones.lan.prefix | ansible.utils.ipaddr(network_zones.lan.offsets['ch-prometheus']) | ansible.utils.ipaddr('address') }}:/" - path: /srv/files - fstype: nfs4 - opts: nodev,x-systemd.automount,nofail,ro - state: mounted + - role: kodi/config diff --git a/inventory/host_vars/ch-cm4-test.yml b/inventory/host_vars/ch-cm4-test.yml index 314f7f2b..03c5d33c 100644 --- a/inventory/host_vars/ch-cm4-test.yml +++ b/inventory/host_vars/ch-cm4-test.yml @@ -27,3 +27,25 @@ base_entropy_generator: rngd kodi_standalone_support_packages_extra: - libgl1-mesa-dri ## missing dep for RaspiOS Kodi Package, TODO: bugreport + +kodi_config_nfs4_mounts: + - src: "{{ network_zones.lan.prefix | ansible.utils.ipaddr(network_zones.lan.offsets['ch-prometheus']) | ansible.utils.ipaddr('address') }}:/" + path: /srv/files + +kodi_config_guisettings: + locale.keyboardlayouts: "German ABC|German QWERTZ" + locale.activekeyboardlayout: "German QWERTZ" + locale.country: Central Europe + locale.timezonecountry: Austria + locale.timezone: Europe/Vienna + services.devicename: "chaos at media (cm4-test)" + services.webserver: "true" + services.webserverauthentication: "false" + services.esallinterfaces: "true" + +kodi_config_sources: + video: + - name: Series + path: /srv/files/series + - name: Movies + path: /srv/files/movies diff --git a/inventory/host_vars/ch-mcbr.yml b/inventory/host_vars/ch-mcbr.yml index 1ac236c8..fb464fb5 100644 --- a/inventory/host_vars/ch-mcbr.yml +++ b/inventory/host_vars/ch-mcbr.yml @@ -45,3 +45,25 @@ kodi_standalone_kodi_packages_extra: - kodi-repository-kodi - kodi-inputstream-adaptive - kodi-inputstream-rtmp + +kodi_config_nfs4_mounts: + - src: "{{ network_zones.lan.prefix | ansible.utils.ipaddr(network_zones.lan.offsets['ch-prometheus']) | ansible.utils.ipaddr('address') }}:/" + path: /srv/files + +kodi_config_guisettings: + locale.keyboardlayouts: "German ABC|German QWERTZ" + locale.activekeyboardlayout: "German QWERTZ" + locale.country: Central Europe + locale.timezonecountry: Austria + locale.timezone: Europe/Vienna + services.devicename: "chaos at media (br)" + services.webserver: "true" + services.webserverauthentication: "false" + services.esallinterfaces: "true" + +kodi_config_sources: + video: + - name: Series + path: /srv/files/series + - name: Movies + path: /srv/files/movies 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..e3c6ef25 --- /dev/null +++ b/roles/kodi/config/tasks/main.yml @@ -0,0 +1,54 @@ +--- + ## 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 + +- 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 + 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> |