From 2a4dc82e21aeca86884f44dfd21b87635fb711cc Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sat, 8 Jul 2017 13:37:35 +0200 Subject: [PATCH] add xorg autoconfiguration, install some config files for vdr, update nfs- and avahi configuration --- Manual.org | 1124 ++++++++++++++++- group_vars/all | 8 +- handlers/main.yml | 1 - install-yavdr.sh | 1 - library/hardware_facts.py | 1 - library/satip_facts.py | 1 - library/xrandr_facts.py | 82 +- roles/kodi/files/userdata/Lircmap.xml | 60 + roles/kodi/files/userdata/keymaps/remote.xml | 539 ++++++++ roles/kodi/tasks/main.yml | 14 + roles/nfs-server/avahi/service.j2 | 11 + roles/nfs-server/templates/avahi/service.j2 | 11 + roles/samba-config/templates/smb.conf.j2 | 2 - roles/vdr/files/keymacros.conf | 14 + roles/vdr/files/remote.conf | 128 ++ roles/vdr/tasks/main.yml | 22 +- roles/yavdr-common/defaults/main.yml | 4 - roles/yavdr-common/tasks/main.yml | 10 +- roles/yavdr-network/avahi/service.j2 | 11 + roles/yavdr-network/tasks/main.yml | 9 +- roles/yavdr-remote/tasks/main.yml | 12 + roles/yavdr-xorg/tasks/main.yml | 18 + .../yavdr-xorg/templates/openbox/autostart.j2 | 1 - roles/yavdr-xorg/templates/openbox/rc.xml.j2 | 2 +- .../systemd/system/x-verbose@.service.j2 | 2 +- .../templates/systemd/vdr-environ.j2 | 2 + .../yavdr-xorg/templates/xorg-verbose.conf.j2 | 20 + roles/yavdr-xorg/templates/xorg.conf.j2 | 98 ++ 28 files changed, 2134 insertions(+), 74 deletions(-) create mode 100644 roles/kodi/files/userdata/Lircmap.xml create mode 100644 roles/kodi/files/userdata/keymaps/remote.xml create mode 100644 roles/nfs-server/avahi/service.j2 create mode 100644 roles/nfs-server/templates/avahi/service.j2 create mode 100644 roles/vdr/files/keymacros.conf create mode 100644 roles/vdr/files/remote.conf create mode 100644 roles/yavdr-network/avahi/service.j2 create mode 100644 roles/yavdr-xorg/templates/systemd/vdr-environ.j2 create mode 100644 roles/yavdr-xorg/templates/xorg-verbose.conf.j2 create mode 100644 roles/yavdr-xorg/templates/xorg.conf.j2 diff --git a/Manual.org b/Manual.org index f6a1a96..6bb643d 100644 --- a/Manual.org +++ b/Manual.org @@ -13,7 +13,7 @@ # Local Variables: # org-src-preserve-indentation: t # End: -#+PROPERTY: header-args :mkdirp yes +#+PROPERTY: header-args :mkdirp yes :padline no #+TITLE: Ansible Playbooks for yaVDR 0.7 #+Author: Alexander Grothe :END: @@ -55,7 +55,6 @@ Format: "%d:%d:%d" (lspci liefert es als "%04x:%02x:%02x.%x", domain, bus, devic - Wie BusID der xrandr-Ausgabe zuordnen? *** NVIDIA-Dokumentation zur BusID: **** What is the format of a PCI Bus ID? - Different tools have different formats for the PCI Bus ID of a PCI device. The X server's "BusID" X configuration file option interprets the BusID string in the format "bus@domain:device:function" (the "@domain" portion is only needed if the PCI domain is non-zero), in decimal. More specifically, @@ -231,6 +230,7 @@ vdr: uid: 666 gid: 666 home: /var/lib/vdr + confdir: /var/lib/vdr recdir: /srv/vdr/video hide_first_recording_level: false safe_dirnames: true # escape characters (useful for windows clients and FAT/NTFS file systems) @@ -456,7 +456,7 @@ yavdr-common executes the following tasks: - anacron - at - bash-completion - - biosdevname + #- biosdevname # caution: may change device names after a minimal installation! - debconf-utils - linux-firmware - psmisc @@ -595,7 +595,7 @@ The additional plugins to install can be set in the variable ~{{vdr_plugins}}~ i '{{ vdr_plugins | default({}) }}' notify: [ 'Restart VDR' ] #+END_SRC -**** expand template for remote.conf +**** copy vdr configuration files (if they don't exist yet) #+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes - name: ensure vdr is stopped systemd: @@ -603,18 +603,29 @@ The additional plugins to install can be set in the variable ~{{vdr_plugins}}~ i state: stopped notify: [ 'Start VDR' ] -- name: 'vdr configuration | expand template for remote.conf' - template: - src: templates/remote.conf.j2 - dest: '/var/lib/vdr/remote.conf' +- name: "vdr configuration | copy remote.conf if it doesn't exist yet" + copy: + src: files/remote.conf + dest: '{{ vdr.confdir }}/remote.conf' owner: '{{ vdr.user }}' group: '{{ vdr.group }}' mode: 0644 + force: no + +- name: "vdr configuration | copy keymacros.conf if it doesn't exist yet" + copy: + src: files/keymacros.conf + dest: '{{ vdr.confdir }}/keymacros.conf' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + mode: 0644 + force: no #+END_SRC *** templates +*** files **** remote.conf -#+BEGIN_SRC conf :tangle roles/vdr/templates/remote.conf.j2 :mkdirp yes :padline no +#+BEGIN_SRC conf :tangle roles/vdr/files/remote.conf :mkdirp yes :padline no LIRC.Up KEY_UP LIRC.Down KEY_DOWN LIRC.Menu KEY_MENU @@ -743,6 +754,25 @@ XKeySym.Stop XF86AudioStop XKeySym.Play/Pause XF86AudioPlay XKeySym.Prev XF86AudioPrev XKeySym.Next XF86AudioNext +#+END_SRC +**** keymacros.conf +#+BEGIN_SRC conf :tangle roles/vdr/files/keymacros.conf :padline no +# Remote control key macros for VDR +# +# Format: +# +# macrokey key1 key2 key3... +# macrokey @plugin key1 key2 key3... +# +# See man vdr(5) + +Red Recordings +Green Schedule +Yellow Info +Blue Timers +User0 @osdteletext + + #+END_SRC ** STARTED yavdr-network *** default variables @@ -775,7 +805,7 @@ install_avahi: true # register: wol # with_items: '{% for interface in ansible_interfaces if interface != 'lo' and interface != 'bond0' %}' -- name: restart autofs +- name: restart autofs if running systemd: name: autofs state: restarted @@ -789,6 +819,13 @@ install_avahi: true enabled: yes masked: no +- name: restart avahi-linker if running + systemd: + name: avahi-linker + state: restarted + enabled: yes + masked: no + - name: start avahi-linker systemd: name: avahi-linker @@ -798,6 +835,7 @@ install_avahi: true #+END_SRC ** nfs-server +*** TODO avahi-services für NFS beim Stoppen des nfs-kernel-servers depublizieren, beim Start wieder announcen *** tasks #+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes :padline no --- @@ -864,6 +902,17 @@ install_avahi: true when: - install_lircd is defined and install_lircd +- name: disable lircd.socket and lircd.service (conflict with eventlircd with default configuration) + systemd: + name: '{{ item }}' + enabled: no + state: stopped + masked: yes + with_items: + - lircd.service + - lircd.socket + ignore_errors: yes + - name: install eventlircd apt: name: eventlircd @@ -871,6 +920,7 @@ install_avahi: true when: install_eventlircd is defined and install_eventlircd + # TODO: upload lircd2uinput package to PPA #- name: install lircd2uinput # tag: install @@ -1349,6 +1399,7 @@ b'\xde\xad\xbe\xef' - openbox - tmux - kiosk-browser + - read-edid #- yavdr-xorg - name: "stop x@vt7.service" @@ -1361,6 +1412,11 @@ b'\xde\xad\xbe\xef' src: "templates/systemd/system/x-verbose@.service.j2" dest: "/etc/systemd/system/x-verbose@.service" +- name: "expand template for xorg-verbose.conf" + template: + src: "templates/xorg-verbose.conf.j2" + dest: "/etc/X11/xorg-verbose.conf" + - name: "start x-verbose@.service" systemd: name: "x-verbose@vt7.service" @@ -1376,6 +1432,13 @@ b'\xde\xad\xbe\xef' - name: "detect xorg configuration" action: xrandr_facts +- debug: + var: xorg.primary + +- debug: + var: xorg.secondary + when: xorg.secondary is defined + - name: "stop x-verbose@vt7.service" systemd: name: "x-verbose@vt7.service" @@ -1384,6 +1447,11 @@ b'\xde\xad\xbe\xef' masked: true ### TODO: Create xorg configuration +- name: create xorg.conf (test) + template: + src: templates/xorg.conf.j2 + dest: /etc/X11/xorg.conf + backup: yes - name: create folders for user session file: @@ -1497,7 +1565,7 @@ Before=graphical.target [Service] Type=forking -ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I +ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I -config /etc/X11/xorg-debug.conf #+END_SRC ***** Drop-in snippet for vdr.service #+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/vdr-xorg.conf :mkdirp yes :padline no @@ -1514,6 +1582,329 @@ Wants=x@vt7.service # {{ ansible_managed_file }} exec openbox-session #+END_SRC +***** xorg.conf +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/xorg-verbose.conf.j2 +Section "Device" + Identifier "nvidia" + Driver "nvidia" + Option "NoLogo" "true" + Option "DynamicTwinView" "true" + Option "NoFlip" "false" +# Option "FlatPanelProperties" "Scaling = Native" +# Option "ModeValidation" "NoVesaModes, NoXServerModes" +# Option "ModeDebug" "true" +# Option "HWCursor" "false" +EndSection + +Section "Screen" + Identifier "screen" + Device "nvidia" +EndSection + +Section "Extensions" + Option "Composite" "false" +EndSection +#+END_SRC +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/xorg.conf.j2 +{{ ansible_managed_file | comment }} + +Section "ServerLayout" + Identifier "Layout0" + Screen 0 "Screen0" +{% if xorg.secondary is defined %} + Screen 1 "Screen1" RightOf "Screen0" +{% endif %} + #InputDevice "Keyboard0" "CoreKeyboard" + #InputDevice "Mouse0" "CorePointer" +EndSection + +Section "InputClass" + Identifier "exclude eventlircd devices" + MatchTag "eventlircd" + Option "Ignore" "True" +EndSection + +Section "Monitor" + Identifier "Monitor0" + VendorName "{{ xorg.primary.vendor }}" + ModelName "{{ xorg.primary.model }}" + Option "DPMS" + Option "ExactModeTimingsDVI" "True" +EndSection + +Section "Device" + Identifier "Device0" + Driver "nvidia" + VendorName "NVIDIA Corporation" + Option "NoLogo" "true" +{% if xorg.primary.bus_id is defined %} + BoardName "{{ xorg.primary.gpu_name }}" + BusID "{{ xorg.primary.bus_id }}" +{% else %} + BoardName "Unknown" +{% endif %} + Screen 0 +EndSection + + +Section "Screen" + Identifier "Screen0" + Device "Device0" + Monitor "Monitor0" + DefaultDepth 24 + Option "nvidiaXineramaInfoOrder" "{{ xorg.primary.connector }}" + Option "ConnectedMonitor" "{{ xorg.primary.connector }}" + Option "UseDisplayDevice" "{{ xorg.primary.connector }}" + Option "CustomEDID" "{{ xorg.primary.connector }}:/etc/X11/edid.{{ xorg.primary.connector }}.bin" + Option "metamodes" "{{ xorg.primary.connector }}: {{ xorg.primary.mode }} +0+0" + Option "SLI" "Off" + Option "MultiGPU" "Off" + Option "BaseMosaic" "off" + SubSection "Display" + Depth 24 + EndSubSection +EndSection + +{% if xorg.secondary is defined %} +Section "Device" + Identifier "Device1" + Driver "nvidia" + VendorName "NVIDIA Corporation" + Option "NoLogo" "true" +{% if xorg.secondary.bus_id is defined %} + BoardName "{{ xorg.primary.gpu_name }}" + BusID "{{ xorg.primary.bus_id }}" +{% else %} + BoardName "Unknown" +{% endif %} + Screen 1 +EndSection + +Section "Monitor" + Identifier "Monitor1" + VendorName "{{ xorg.secondary.vendor }}" + ModelName "{{ xorg.secondary.model }}" +EndSection + +Section "Screen" + Identifier "Screen1" + Device "Device1" + Monitor "Monitor1" + DefaultDepth 24 + Option "nvidiaXineramaInfoOrder" "{{ xorg.secondary.connector }}" + Option "ConnectedMonitor" "{{ xorg.secondary.connector }}" + Option "UseDisplayDevice" "{{ xorg.secondary.connector }}" + Option "CustomEDID" "{{ xorg.secondary.connector }}:/etc/X11/edid.{{ xorg.secondary.connector }}.bin" + Option "metamodes" "{{ xorg.secondary.connector }}: {{ xorg.secondary.mode }} +0+0" + Option "SLI" "Off" + Option "MultiGPU" "Off" + Option "BaseMosaic" "off" + SubSection "Display" + Depth 24 + EndSubSection +EndSection +{% endif %} + + + + +#+END_SRC + +#+BEGIN_SRC shell :tangle roles/template-test/templates/xorg.conf_test.j2 +{{ ansible_managed_file | comment }} + +Section "ServerLayout" + Identifier "Layout0" + Screen 0 "Screen0" + {% if xorg.best_tv_mode.secondary is defined %} + Screen 1 "Screen1" RightOf "Screen0" + {% endif %} + InputDevice "Keyboard0" "CoreKeyboard" + InputDevice "Mouse0" "CorePointer" +EndSection + +Section "InputDevice" + # generated from default + Identifier "Mouse0" + Driver "mouse" + Option "Protocol" "auto" + Option "Device" "/dev/psaux" + Option "Emulate3Buttons" "no" + Option "ZAxisMapping" "4 5" +EndSection + +# ignore devices with eventlircd tag +# ENV{ID_INPUT.tags}+="eventlircd" +# must be set by an udev rule +Section "InputClass" + Identifier "ignore eventlircd devices" + MatchTag "eventlircd" + Option "Ignore" "True" +EndSection + + + +Section "InputDevice" + # generated from default + Identifier "Keyboard0" + Driver "kbd" +EndSection + + +Section "Monitor" + Identifier "Monitor0" + VendorName "Unknown" + ModelName "Unknown" +{# TODO: VGA2SCART support (if needed) +{% if system.x11.display.0.default == "VGA2Scart_4_3" or system.x11.display.0.default == "VGA2Scart_16_9" %} + HorizSync 14-17 + VertRefresh 49-61 + {% if system.x11.display.0.default == "VGA2Scart_4_3" %} + Modeline "VGA2Scart_4_3" 13.875 720 744 808 888 576 580 585 625 -HSync -Vsync interlace + {% elif system.x11.display.0.default == "VGA2Scart_16_9" %} + Modeline "VGA2Scart_16_9" 19 1024 1032 1120 1216 576 581 586 625 -Hsync -Vsync interlace + {% endif %} +{% endif %} +#} + Option "DPMS" + Option "ExactModeTimingsDVI" "True" +EndSection + + +{% if xrandr.best_tv_mode.secondary is defined %} +Section "Monitor" + Identifier "Monitor1" + VendorName "Unknown" + ModelName "Unknown" +{# +{% if system.x11.display.1.default in ("VGA2Scart_4_3", "VGA2Scart_16_9") %} + HorizSync 14-17 + VertRefresh 49-61 + {% if system.x11.display.1.default == "VGA2Scart_4_3" %} + Modeline "VGA2Scart_4_3" 13.875 720 744 808 888 576 580 585 625 -HSync -Vsync interlace + {% elif system.x11.display.1.default == "VGA2Scart_16_9" %} + Modeline "VGA2Scart_16_9" 19 1024 1032 1120 1216 576 581 586 625 -Hsync -Vsync interlace + {% endif %} + Option "DPMS" + Option "ExactModeTimingsDVI" "True" +{% endif %} +#} +EndSection +{% endif %} + +Section "Device" + Identifier "Device0" +{% if system.hardware.nvidia.detected %} + Driver "nvidia" + VendorName "NVIDIA Corporation" +{% endif %} + Screen 0 + Option "DPI" "100x100" +{% if system.hardware.nvidia.busid is defined and system.hardware.busid %} + BusID "PCI: {{ system.hardware.nvidia.busid }}" +{% endif %} + Option "NoLogo" "True" + Option "UseEvents" "True" + Option "TripleBuffer" "False" + Option "AddARGBGLXVisuals" "True" + Option "TwinView" "0" + Option "DynamicTwinView" "0" + Option "OnDemandVBlankinterrupts" "on" + Option "FlatPanelProperties" "Scaling = Native" +EndSection + +{% if xrandr.best_tv_mode.secondary is defined %} +Section "Device" + Identifier "Device1" + {% if system.hardware.nvidia.detected %} + Driver "nvidia" + VendorName "NVIDIA Corporation" + {% endif %} + Screen 1 + {% if system.hardware.nvidia.busid is defined and system.hardware.nvidia.busid %} + BusID "PCI: {{ system.hardware.nvidia.busid }}" + {% endif %} + Option "NoLogo" "True" + Option "UseEvents" "True" + Option "TripleBuffer" "False" + Option "AddARGBGLXVisuals" "True" + Option "TwinView" "0" + Option "DynamicTwinView" "0" +EndSection +{% endif %} + + +Section "Screen" + Identifier "Screen0" + Device "Device0" + Monitor "Monitor0" + DefaultDepth 24 + SubSection "Display" + Depth 24 +{% if xrandr.best_tv_mode.primary is defined %} + Modes "{{ xrandr.best_tv_mode.primary.mode }}"{#{% for mode in xrandr %}{% if mode != system.x11.display.0.default %} "{{ mode }}"{% endif %}{% endfor %}#} nvidia-auto-select + +{% elif system.hardware.nvidia.detected == 1 %} + Modes "nvidia-auto-select" +{% endif %} + EndSubSection +{% if system.x11.display.0.default or system.x11.default %} + {% if system.x11.display.0.device is definded and system.x11.display.0.device %} + Option "ConnectedMonitor" {{ system.x11.display.0.device }} + {% else %} + Option "ConnectedMonitor" {{ system.x11.default }} + {% endif %} + # Option "ConnectedMonitor" ", " + #Option "ConnectedMonitor" + " + + + + + , " +# Option "UseDisplayDevice" "" +# +# +# Option "CustomEDID" ":/etc/X11/edid.0.yavdr" +# +# +# Option "MetaModes" ": { ViewPortIn=x, ViewPortOut=x++ }" +# +# Option "MetaModes" ": { ViewPortIn=x, ViewPortOut=x++ }" +{% endif %} +EndSection + +{% if system.x11.dualhead.enabled == "1" %} +Section "Screen" + + Identifier "Screen1" + Device "Device1" + Monitor "Monitor1" + DefaultDepth 24 + SubSection "Display" + Depth 24 +{% if system.x11.display.0.default is defined and system.x11.display.0.default %} + Modes "{{ system.x11.display.1.default }}"{% for mode in system.x11.display.1.mode %}{% if mode != system.x11.display.1.default %} "{{ mode }}"{% endif %}{% endfor %} + +{% elif system.hardware.nvidia.detected == "1" %} + Modes "nvidia-auto-select" +{% endif %} + EndSubSection + +# +# Option "UseDisplayDevice" "" +# +# +# Option "CustomEDID" ":/etc/X11/edid.1.yavdr" +# +# +# Option "MetaModes" ": { ViewPortIn=x, ViewPortOut=x++ }" +# +# Option "MetaModes" ": { ViewPortIn=x, ViewPortOut=x++ }" +# +EndSection +{% endif %} +#+END_SRC **** vdr #+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/vdr-environ.j2 [Service] @@ -1529,9 +1920,7 @@ After=default.target pulseaudio.service Wants=dbus.service pulseaudio.service AllowIsolate=yes #+END_SRC -#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/xorg.conf.yavdr :mkdirp yes -#+END_SRC ***** detect-second-display #+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 :mkdirp yes :padline no [Unit] @@ -2588,13 +2977,13 @@ include = /etc/samba/smb.conf.custom #+END_SRC ** STARTED autoinstall-drivers It would be nice to be able to detect if it is suitable to install those drivers: -*** sundtek for Sundtek devices (local or network connection) +*** TODO sundtek for Sundtek devices (local or network connection) Vendor-IDs: - eb1a:5[1b2] (alte Generation) - 2659:* (neuere Sticks) -*** dddvb-dkms if only newer DD cards are detected -*** media-build-experimental (up to kernel 4.8) for "old" cards like TT S2-6400 FF -*** newly merged DD drivers +*** TODO dddvb-dkms if only newer DD cards are detected +*** TODO media-build-experimental (up to kernel 4.8) for "old" cards like TT S2-6400 FF +*** TODO newly merged DD drivers from http://www.vdr-portal.de/board18-vdr-hardware/board102-dvb-karten/120817-treiber-der-cine-ctv6-ddbridge-ci-in-den-kernel-integrieren/ ** autoinstall-ubuntu-drivers @@ -2770,6 +3159,19 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll owner: '{{ vdr.user }}' group: '{{ vdr.group }}' +- name: create kodi user directory + file: + dest: '{{ vdr.home }}/{{ item }}' + state: directory + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + mode: "0775" + with_items: + - .kodi + - .kodi/userdata + - .kodi/userdata/keymaps + +# TODO: Add configuration files #+END_SRC *** templates **** kodi.service @@ -2787,6 +3189,613 @@ TimeoutStopSec=10 SuccessExitStatus=0 127 Restart=on-failure #+END_SRC +*** files +**** Lircmap.xml +#+BEGIN_SRC xml :tangle roles/kodi/files/userdata/Lircmap.xml :padline no :mkdirp yes + + + cx23885_remote + devinput + KEY_UP + KEY_DOWN + KEY_MENU + + KEY_ESC + KEY_LEFT + KEY_RIGHT + KEY_RED + KEY_GREEN + KEY_YELLOW + KEY_BLUE + KEY_0 + KEY_1 + KEY_2 + KEY_3 + KEY_4 + KEY_5 + KEY_6 + KEY_7 + KEY_8 + KEY_9 + KEY_INFO + KEY_PLAY + KEY_PLAYPAUSE + KEY_PAUSE + KEY_STOP + KEY_RECORD + KEY_FASTFORWARD + KEY_REWIND + KEY_NEXT + KEY_BACK + KEY_POWER2 + KEY_CHANNELUP + KEY_CHANNELDOWN + KEY_PROG3 + KEY_VOLUMEUP + KEY_VOLUMEDOWN + KEY_TEXT + KEY_MUTE + KEY_SELECT + KEY_SUBTITLE + + KEY_MUTE + KEY_VIDEO + KEY_AUDIO + KEY_IMAGES + KEY_PVR + KEY_EPG + KEY_SCREEN + KEY_PROG4 + KEY_ZOOM + KEY_CHANNEL + KEY_TV + KEY_FN + + +#+END_SRC +**** keymaps +***** remote.xml +#+BEGIN_SRC xml :tangle roles/kodi/files/userdata/keymaps/remote.xml :padline no :mkdirp yes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XBMC.ejecttray() + Playlist + + + PlayPause + Pause + Stop + FastForward + Rewind + Left + Right + Up + Down + + PageUp + PageDown + ParentDir + PreviousMenu + ContextMenu + Info + SkipNext + SkipPrevious + FullScreen + PreviousMenu + Screenshot + VolumeUp + VolumeDown + Mute + XBMC.Quit() + XBMC.ActivateWindow(MyVideos) + XBMC.ActivateWindow(MyMusic) + XBMC.ActivateWindow(MyPictures) + + XBMC.ActivateWindowAndFocus(MyPVR, 34,0, 13,0) + + XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0) + + XBMC.ActivateWindowAndFocus(MyPVR, 32,0, 11,0) + + XBMC.ActivateWindowAndFocus(MyPVR, 33,0, 12,0) + XBMC.ActivateWindow(Home) + XBMC.ActivateWindow(MyVideos) + XBMC.ActivateWindow(MyMusic) + + Number0 + Number1 + JumpSMS2 + JumpSMS3 + JumpSMS4 + JumpSMS5 + JumpSMS6 + JumpSMS7 + JumpSMS8 + JumpSMS9 + + ShowSubtitles + FullScreen + ContextMenu + XBMC.ActivateWindow(MyMusicPlaylist) + + + + + XBMC.Skin.ToggleSetting(HomeViewToggle) + XBMC.ActivateWindow(SystemInfo) + XBMC.ActivateWindow(Weather) + XBMC.ActivateWindow(Settings) + FullScreen + FullScreen + + + + + Delete + + + + + Playlist + Delete + + + + + Queue + + + + + Queue + Queue + ContextMenu + + + + + Queue + Queue + + + + + FullScreen + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + Rewind + FastForward + Play + Pause + StepForward + StepBack + CodecInfo + OSD + OSD + XBMC.ActivateWindow(PVROSDChannels) + XBMC.ActivateWindow(PVROSDChannels) + AspectRatio + + XBMC.ActivateWindow(Teletext) + SkipNext + SkipPrevious + XBMC.PlayerControl(Record) + + + + + FullScreen + Rewind + FastForward + Play + Pause + StepForward + StepBack + AspectRatio + CodecInfo + + OSD + + + + + Close + Close + + + + + XBMC.ActivateWindow(MyMusicPlaylist) + + + FullScreen + AnalogSeekForward + AnalogSeekBack + CodecInfo + Rewind + FastForward + SkipNext + SkipPrevious + Play + Pause + XBMC.ActivateWindow(PVROSDChannels) + XBMC.ActivateWindow(MyMusicPlaylist) + + XBMC.ActivateWindow(MusicOSD) + XBMC.ActivateWindow(MusicOSD) + + + + + Close + Close + Close + CodecInfo + + + + + Close + Close + + + + + Close + Close + + + + + ZoomNormal + ZoomLevel1 + ZoomLevel2 + ZoomLevel3 + ZoomLevel4 + ZoomLevel5 + ZoomLevel6 + ZoomLevel7 + ZoomLevel8 + ZoomLevel9 + CodecInfo + ZoomIn + ZoomOut + + Pause + Play + PreviousMenu + + + + + + NextCalibration + ResetCalibration + NextResolution + NextResolution + + + + + + NextCalibration + ResetCalibration + + + + + Close + + + + + PreviousMenu + Close + Close + + + + + OSD + PreviousMenu + Info + CodecInfo + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + + + + + Close + Close + Close + + + + + Close + Close + Close + + + + + Close + Close + Close + Delete + + + + + Queue + Delete + ToggleWatched + Queue + + + + + Queue + Queue + ContextMenu + ToggleWatched + Queue + + + + + Queue + Queue + ContextMenu + + + + + Playlist + Delete + Delete + + + + + BackSpace + Shift + Symbols + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + CursorLeft + CursorRight + + + + + Close + Close + + + + + Close + + + + + XBMC.ActivateWindow(ScriptsDebugInfo) + + + + + Info + + + + + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + BackSpace + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + Close + + + + + Close + + + + + Close + PreviousMenu + + + + + Close + PreviousMenu + + + + + NextPicture + PreviousPicture + Close + Close + + + + + number0 + number1 + number2 + number3 + number4 + number5 + number6 + number7 + number8 + number9 + Red + Green + Yellow + Blue + Info + Close + Close + Close + Close + + + + + Close + + + +#+END_SRC ** template-test #+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml :padline no --- @@ -3283,6 +4292,7 @@ if __name__ == '__main__': from __future__ import print_function import ast import binascii +import csv import re import subprocess from collections import namedtuple @@ -3303,11 +4313,6 @@ options: default: ":0" description: - the DISPLAY variable to use when calling xrandr - multi_display: - required: False - default: "False" - description: - - check additional screens (:0.0 .. :0.n) until xrandr fails to collect information preferred_outpus: required: False default: ["HDMI", "DP", "DVI", "VGA", "TV": 0] @@ -3340,7 +4345,6 @@ EXAMPLES = ''' ARG_SPECS = { 'display': dict(default=":0", type='str', required=False), - 'multi_display': dict(default=False, type='bool', required=False), 'preferred_outputs': dict( default=["HDMI", "DP", "DVI", "VGA", "TV"], type='list', required=False), 'preferred_refreshrates': dict( @@ -3454,6 +4458,45 @@ def parse_xrandr_verbose(iterator): break return xorg +def parse_edid_data(edid): + vendor = "Unknown" + model = "Unknown" + data = subprocess.check_output("parse-edid < {}".format(edid), shell=True, universal_newlines=True) + for line in data.splitlines(): + if "VendorName" in line: + vendor = line.strip().split('"')[1] + if "ModelName" in line: + model = line.strip().split('"')[1] + return vendor, model + +def collect_nvidia_data(): + BusID_RE = re.compile(( + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + '\.' + '(?P[0-9a-fA-F]+)' + )) + try: + data = subprocess.check_output(["nvidia-smi", "--query-gpu=name,pci.bus_id", "--format=csv", "-i0"], + universal_newlines=True) + except subprocess.CalledProcessError: + pass + else: + for row in csv.DictReader(data.splitlines(), delimiter=',', skipinitialspace=True): + name = row['name'] + bus_id = row['pci.bus_id'] + # pci.bus_id structure as reported by nvidia-smi: "domain:bus:device.function", in hex. + match = BusID_RE.search(bus_id) + if match: + domain, bus, device, function = (int(n, 16) for n in match.groups()) + bus_id = "PCI:{:d}@{:d}:{:d}:{:d}".format(bus, domain, device, function) + return name, bus_id + raise ValueError + + def output_data(data, write_edids=True): if data: modes = [] @@ -3466,11 +4509,40 @@ def output_data(data, write_edids=True): for refreshrate in refreshrates: modes.append(Mode(connector, resolution, refreshrate)) if modes: - best_mode = max(modes, key=sort_mode) - data['best_tv_mode'] = best_mode + result = {} + try: + gpu_name, bus_id = collect_nvidia_data() + except ValueError: + gpu_name = None + bus_id = None + + def create_entry(my_dict, name, connector, resolution, refreshrate, vendor, model): + my_dict[name] = { + 'connector': connector, + 'resolution': resolution, + 'refreshrate': refreshrate, + 'edid': '/etc/X11/edid.{}.bin'.format(connector), + 'mode': "{}_{}".format(resolution, refreshrate), + 'vendor': vendor, + 'model': model, + } + if gpu_name and bus_id: + result[name]['gpu_name'] = gpu_name + result[name]['bus_id'] = bus_id + + connector_0, resolution_0, refreshrate_0 = max(modes, key=sort_mode)[:3] + vendor_0, model_0 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_0)) + create_entry(result, 'primary', connector_0, resolution_0, refreshrate_0, vendor_0, model_0) + + # check if additional monitors exist + other_modes = [mode for mode in modes if mode[0] != connector_0] + if other_modes: + connector_1, resolution_1, refreshrate_1 = max(other_modes, key=sort_mode)[:3] + vendor_1, model_1 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_1)) + create_entry(result, 'secondary', connector_1, resolution_1, refreshrate_1, vendor_1, model_1) #print(json.dumps(data, sort_keys=True, indent=4)) - module.exit_json(changed=True if write_edids else False, ansible_facts={'xrandr': data}) + module.exit_json(changed=True if write_edids else False, ansible_facts={'xrandr': data, 'xorg': result}) if __name__ == '__main__': module = AnsibleModule(argument_spec=ARG_SPECS, supports_check_mode=False,) diff --git a/group_vars/all b/group_vars/all index 3a23e6e..8d0ffb9 100644 --- a/group_vars/all +++ b/group_vars/all @@ -3,7 +3,6 @@ # this is the standard text to put in templates ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***" - branch: unstable ppa_owner: 'ppa:yavdr' # a list of all package repositories to be added to the installation @@ -13,7 +12,6 @@ repositories: - '{{ ppa_owner }}/{{branch}}-vdr' - '{{ ppa_owner }}/{{branch}}-yavdr' - '{{ ppa_owner }}/{{branch}}-kodi' - # properties of the user vdr and vdr-related options vdr: user: vdr @@ -21,6 +19,7 @@ vdr: uid: 666 gid: 666 home: /var/lib/vdr + confdir: /var/lib/vdr recdir: /srv/vdr/video hide_first_recording_level: false safe_dirnames: true # escape characters (useful for windows clients and FAT/NTFS file systems) @@ -32,7 +31,6 @@ vdr_plugins: - vdr-plugin-markad - vdr-plugin-restfulapi - vdr-plugin-softhddevice - # dictionary of directories for (shared) files. Automatically exported via NFS and Samba if those roles are enabled media_dirs: audio: /srv/audio @@ -41,21 +39,17 @@ media_dirs: files: /srv/files backups: /srv/backups recordings: '{{ vdr.recdir }}' - nfs: insecure: false # set to true for OS X clients or if you plan to use libnfs as unprivileged user (e.g. KODI) - samba: workgroup: YAVDR windows_compatible: '{{ vdr.safe_dirnames }}' # set to true to disable unix extensions, enable follow symlinks and wide links - # additional packages you want to install extra_packages: - vim - tree - w-scan - bpython3 - #system: # shutdown: poweroff grub: diff --git a/handlers/main.yml b/handlers/main.yml index d7fd733..840b674 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,4 +1,3 @@ - - name: Restart Samba systemd: name: smbd.service diff --git a/install-yavdr.sh b/install-yavdr.sh index d8aa931..d3bd2d8 100755 --- a/install-yavdr.sh +++ b/install-yavdr.sh @@ -1,5 +1,4 @@ #!/bin/bash - if (( $EUID != 0 )); then echo "This script must be run using sudo or as root" exit diff --git a/library/hardware_facts.py b/library/hardware_facts.py index c02736a..2832dd8 100755 --- a/library/hardware_facts.py +++ b/library/hardware_facts.py @@ -1,5 +1,4 @@ #!/usr/bin/env/python - # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. DOCUMENTATION = ''' --- diff --git a/library/satip_facts.py b/library/satip_facts.py index 7b2d4c5..6fe23a9 100755 --- a/library/satip_facts.py +++ b/library/satip_facts.py @@ -1,5 +1,4 @@ #!/usr/bin/env python2 - DOCUMENTATION = ''' --- module: hardware_facts diff --git a/library/xrandr_facts.py b/library/xrandr_facts.py index 2b45c66..69525a2 100755 --- a/library/xrandr_facts.py +++ b/library/xrandr_facts.py @@ -1,8 +1,8 @@ #!/usr/bin/env python2 - from __future__ import print_function import ast import binascii +import csv import re import subprocess from collections import namedtuple @@ -23,11 +23,6 @@ options: default: ":0" description: - the DISPLAY variable to use when calling xrandr - multi_display: - required: False - default: "False" - description: - - check additional screens (:0.0 .. :0.n) until xrandr fails to collect information preferred_outpus: required: False default: ["HDMI", "DP", "DVI", "VGA", "TV": 0] @@ -60,7 +55,6 @@ EXAMPLES = ''' ARG_SPECS = { 'display': dict(default=":0", type='str', required=False), - 'multi_display': dict(default=False, type='bool', required=False), 'preferred_outputs': dict( default=["HDMI", "DP", "DVI", "VGA", "TV"], type='list', required=False), 'preferred_refreshrates': dict( @@ -174,6 +168,45 @@ def parse_xrandr_verbose(iterator): break return xorg +def parse_edid_data(edid): + vendor = "Unknown" + model = "Unknown" + data = subprocess.check_output("parse-edid < {}".format(edid), shell=True, universal_newlines=True) + for line in data.splitlines(): + if "VendorName" in line: + vendor = line.strip().split('"')[1] + if "ModelName" in line: + model = line.strip().split('"')[1] + return vendor, model + +def collect_nvidia_data(): + BusID_RE = re.compile(( + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + '\.' + '(?P[0-9a-fA-F]+)' + )) + try: + data = subprocess.check_output(["nvidia-smi", "--query-gpu=name,pci.bus_id", "--format=csv", "-i0"], + universal_newlines=True) + except subprocess.CalledProcessError: + pass + else: + for row in csv.DictReader(data.splitlines(), delimiter=',', skipinitialspace=True): + name = row['name'] + bus_id = row['pci.bus_id'] + # pci.bus_id structure as reported by nvidia-smi: "domain:bus:device.function", in hex. + match = BusID_RE.search(bus_id) + if match: + domain, bus, device, function = (int(n, 16) for n in match.groups()) + bus_id = "PCI:{:d}@{:d}:{:d}:{:d}".format(bus, domain, device, function) + return name, bus_id + raise ValueError + + def output_data(data, write_edids=True): if data: modes = [] @@ -186,11 +219,40 @@ def output_data(data, write_edids=True): for refreshrate in refreshrates: modes.append(Mode(connector, resolution, refreshrate)) if modes: - best_mode = max(modes, key=sort_mode) - data['best_tv_mode'] = best_mode + result = {} + try: + gpu_name, bus_id = collect_nvidia_data() + except ValueError: + gpu_name = None + bus_id = None + + def create_entry(my_dict, name, connector, resolution, refreshrate, vendor, model): + my_dict[name] = { + 'connector': connector, + 'resolution': resolution, + 'refreshrate': refreshrate, + 'edid': '/etc/X11/edid.{}.bin'.format(connector), + 'mode': "{}_{}".format(resolution, refreshrate), + 'vendor': vendor, + 'model': model, + } + if gpu_name and bus_id: + result[name]['gpu_name'] = gpu_name + result[name]['bus_id'] = bus_id + + connector_0, resolution_0, refreshrate_0 = max(modes, key=sort_mode)[:3] + vendor_0, model_0 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_0)) + create_entry(result, 'primary', connector_0, resolution_0, refreshrate_0, vendor_0, model_0) + + # check if additional monitors exist + other_modes = [mode for mode in modes if mode[0] != connector_0] + if other_modes: + connector_1, resolution_1, refreshrate_1 = max(other_modes, key=sort_mode)[:3] + vendor_1, model_1 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_1)) + create_entry(result, 'secondary', connector_1, resolution_1, refreshrate_1, vendor_1, model_1) #print(json.dumps(data, sort_keys=True, indent=4)) - module.exit_json(changed=True if write_edids else False, ansible_facts={'xrandr': data}) + module.exit_json(changed=True if write_edids else False, ansible_facts={'xrandr': data, 'xorg': result}) if __name__ == '__main__': module = AnsibleModule(argument_spec=ARG_SPECS, supports_check_mode=False,) diff --git a/roles/kodi/files/userdata/Lircmap.xml b/roles/kodi/files/userdata/Lircmap.xml new file mode 100644 index 0000000..178fd37 --- /dev/null +++ b/roles/kodi/files/userdata/Lircmap.xml @@ -0,0 +1,60 @@ + + + cx23885_remote + devinput + KEY_UP + KEY_DOWN + KEY_MENU + + KEY_ESC + KEY_LEFT + KEY_RIGHT + KEY_RED + KEY_GREEN + KEY_YELLOW + KEY_BLUE + KEY_0 + KEY_1 + KEY_2 + KEY_3 + KEY_4 + KEY_5 + KEY_6 + KEY_7 + KEY_8 + KEY_9 + KEY_INFO + KEY_PLAY + KEY_PLAYPAUSE + KEY_PAUSE + KEY_STOP + KEY_RECORD + KEY_FASTFORWARD + KEY_REWIND + KEY_NEXT + KEY_BACK + KEY_POWER2 + KEY_CHANNELUP + KEY_CHANNELDOWN + KEY_PROG3 + KEY_VOLUMEUP + KEY_VOLUMEDOWN + KEY_TEXT + KEY_MUTE + KEY_SELECT + KEY_SUBTITLE + + KEY_MUTE + KEY_VIDEO + KEY_AUDIO + KEY_IMAGES + KEY_PVR + KEY_EPG + KEY_SCREEN + KEY_PROG4 + KEY_ZOOM + KEY_CHANNEL + KEY_TV + KEY_FN + + diff --git a/roles/kodi/files/userdata/keymaps/remote.xml b/roles/kodi/files/userdata/keymaps/remote.xml new file mode 100644 index 0000000..f9543ce --- /dev/null +++ b/roles/kodi/files/userdata/keymaps/remote.xml @@ -0,0 +1,539 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XBMC.ejecttray() + Playlist + + + PlayPause + Pause + Stop + FastForward + Rewind + Left + Right + Up + Down + + PageUp + PageDown + ParentDir + PreviousMenu + ContextMenu + Info + SkipNext + SkipPrevious + FullScreen + PreviousMenu + Screenshot + VolumeUp + VolumeDown + Mute + XBMC.Quit() + XBMC.ActivateWindow(MyVideos) + XBMC.ActivateWindow(MyMusic) + XBMC.ActivateWindow(MyPictures) + + XBMC.ActivateWindowAndFocus(MyPVR, 34,0, 13,0) + + XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0) + + XBMC.ActivateWindowAndFocus(MyPVR, 32,0, 11,0) + + XBMC.ActivateWindowAndFocus(MyPVR, 33,0, 12,0) + XBMC.ActivateWindow(Home) + XBMC.ActivateWindow(MyVideos) + XBMC.ActivateWindow(MyMusic) + + Number0 + Number1 + JumpSMS2 + JumpSMS3 + JumpSMS4 + JumpSMS5 + JumpSMS6 + JumpSMS7 + JumpSMS8 + JumpSMS9 + + ShowSubtitles + FullScreen + ContextMenu + XBMC.ActivateWindow(MyMusicPlaylist) + + + + + XBMC.Skin.ToggleSetting(HomeViewToggle) + XBMC.ActivateWindow(SystemInfo) + XBMC.ActivateWindow(Weather) + XBMC.ActivateWindow(Settings) + FullScreen + FullScreen + + + + + Delete + + + + + Playlist + Delete + + + + + Queue + + + + + Queue + Queue + ContextMenu + + + + + Queue + Queue + + + + + FullScreen + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + Rewind + FastForward + Play + Pause + StepForward + StepBack + CodecInfo + OSD + OSD + XBMC.ActivateWindow(PVROSDChannels) + XBMC.ActivateWindow(PVROSDChannels) + AspectRatio + + XBMC.ActivateWindow(Teletext) + SkipNext + SkipPrevious + XBMC.PlayerControl(Record) + + + + + FullScreen + Rewind + FastForward + Play + Pause + StepForward + StepBack + AspectRatio + CodecInfo + + OSD + + + + + Close + Close + + + + + XBMC.ActivateWindow(MyMusicPlaylist) + + + FullScreen + AnalogSeekForward + AnalogSeekBack + CodecInfo + Rewind + FastForward + SkipNext + SkipPrevious + Play + Pause + XBMC.ActivateWindow(PVROSDChannels) + XBMC.ActivateWindow(MyMusicPlaylist) + + XBMC.ActivateWindow(MusicOSD) + XBMC.ActivateWindow(MusicOSD) + + + + + Close + Close + Close + CodecInfo + + + + + Close + Close + + + + + Close + Close + + + + + ZoomNormal + ZoomLevel1 + ZoomLevel2 + ZoomLevel3 + ZoomLevel4 + ZoomLevel5 + ZoomLevel6 + ZoomLevel7 + ZoomLevel8 + ZoomLevel9 + CodecInfo + ZoomIn + ZoomOut + + Pause + Play + PreviousMenu + + + + + + NextCalibration + ResetCalibration + NextResolution + NextResolution + + + + + + NextCalibration + ResetCalibration + + + + + Close + + + + + PreviousMenu + Close + Close + + + + + OSD + PreviousMenu + Info + CodecInfo + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + + + + + Close + Close + Close + + + + + Close + Close + Close + + + + + Close + Close + Close + Delete + + + + + Queue + Delete + ToggleWatched + Queue + + + + + Queue + Queue + ContextMenu + ToggleWatched + Queue + + + + + Queue + Queue + ContextMenu + + + + + Playlist + Delete + Delete + + + + + BackSpace + Shift + Symbols + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + CursorLeft + CursorRight + + + + + Close + Close + + + + + Close + + + + + XBMC.ActivateWindow(ScriptsDebugInfo) + + + + + Info + + + + + Number0 + Number1 + Number2 + Number3 + Number4 + Number5 + Number6 + Number7 + Number8 + Number9 + BackSpace + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + PreviousMenu + + + + + Close + + + + + Close + + + + + Close + PreviousMenu + + + + + Close + PreviousMenu + + + + + NextPicture + PreviousPicture + Close + Close + + + + + number0 + number1 + number2 + number3 + number4 + number5 + number6 + number7 + number8 + number9 + Red + Green + Yellow + Blue + Info + Close + Close + Close + Close + + + + + Close + + + diff --git a/roles/kodi/tasks/main.yml b/roles/kodi/tasks/main.yml index 971ac53..66ab010 100644 --- a/roles/kodi/tasks/main.yml +++ b/roles/kodi/tasks/main.yml @@ -22,3 +22,17 @@ mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' + +- name: create kodi user directory + file: + dest: '{{ vdr.home }}/{{ item }}' + state: directory + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + mode: "0775" + with_items: + - .kodi + - .kodi/userdata + - .kodi/userdata/keymaps + +# TODO: Add configuration files diff --git a/roles/nfs-server/avahi/service.j2 b/roles/nfs-server/avahi/service.j2 new file mode 100644 index 0000000..cef3154 --- /dev/null +++ b/roles/nfs-server/avahi/service.j2 @@ -0,0 +1,11 @@ + + + +{{ item.value|capitalize }} on %h ## Name + + _nfs._tcp + 2049 + path={{ item.value }} ## path to shared Folder + subtype={% 'vdr' if item == 'recordings' else item %} ## subtype + + diff --git a/roles/nfs-server/templates/avahi/service.j2 b/roles/nfs-server/templates/avahi/service.j2 new file mode 100644 index 0000000..3e59604 --- /dev/null +++ b/roles/nfs-server/templates/avahi/service.j2 @@ -0,0 +1,11 @@ + + + +{{ item.key|capitalize }} on %h ## Name + + _nfs._tcp + 2049 + path={{ item.value }} ## path to shared Folder + subtype={{ 'vdr' if item.key == 'recordings' else item.key }} ## subtype + + diff --git a/roles/samba-config/templates/smb.conf.j2 b/roles/samba-config/templates/smb.conf.j2 index befd2b7..42b03d9 100644 --- a/roles/samba-config/templates/smb.conf.j2 +++ b/roles/samba-config/templates/smb.conf.j2 @@ -77,7 +77,6 @@ follow symlinks= yes wide links= yes {% endif %} - {% for name, path in media_dirs.iteritems() %} [{{ name }}] path = {{ path }} @@ -93,5 +92,4 @@ wide links = yes {% endfor %} - include = /etc/samba/smb.conf.custom diff --git a/roles/vdr/files/keymacros.conf b/roles/vdr/files/keymacros.conf new file mode 100644 index 0000000..8da9659 --- /dev/null +++ b/roles/vdr/files/keymacros.conf @@ -0,0 +1,14 @@ +# Remote control key macros for VDR +# +# Format: +# +# macrokey key1 key2 key3... +# macrokey @plugin key1 key2 key3... +# +# See man vdr(5) + +Red Recordings +Green Schedule +Yellow Info +Blue Timers +User0 @osdteletext diff --git a/roles/vdr/files/remote.conf b/roles/vdr/files/remote.conf new file mode 100644 index 0000000..208722d --- /dev/null +++ b/roles/vdr/files/remote.conf @@ -0,0 +1,128 @@ +LIRC.Up KEY_UP +LIRC.Down KEY_DOWN +LIRC.Menu KEY_MENU +LIRC.Ok KEY_OK +LIRC.Back KEY_ESC +LIRC.Left KEY_LEFT +LIRC.Right KEY_RIGHT +LIRC.Red KEY_RED +LIRC.Green KEY_GREEN +LIRC.Yellow KEY_YELLOW +LIRC.Blue KEY_BLUE +LIRC.0 KEY_0 +LIRC.1 KEY_1 +LIRC.2 KEY_2 +LIRC.3 KEY_3 +LIRC.4 KEY_4 +LIRC.5 KEY_5 +LIRC.6 KEY_6 +LIRC.7 KEY_7 +LIRC.8 KEY_8 +LIRC.9 KEY_9 +LIRC.Info KEY_INFO +LIRC.Play KEY_PLAY +LIRC.Pause KEY_PAUSE +LIRC.Play/Pause KEY_PLAYPAUSE +LIRC.Stop KEY_STOP +LIRC.Record KEY_RECORD +LIRC.FastFwd KEY_FASTFORWARD +LIRC.FastRew KEY_REWIND +LIRC.Next KEY_NEXT +LIRC.Prev KEY_BACK +LIRC.Power KEY_POWER2 +LIRC.Channel+ KEY_CHANNELUP +LIRC.Channel- KEY_CHANNELDOWN +LIRC.PrevChannel KEY_PREVIOUS +LIRC.Volume+ KEY_VOLUMEUP +LIRC.Volume- KEY_VOLUMEDOWN +LIRC.Mute KEY_MUTE +LIRC.Subtitles KEY_SUBTITLE +LIRC.Schedule KEY_EPG +LIRC.Channels KEY_CHANNEL +LIRC.Commands KEY_FAVORITES +LIRC.Audio KEY_MODE +LIRC.Timers KEY_TIME +LIRC.Recordings KEY_PVR +LIRC.Setup KEY_SETUP +LIRC.User0 KEY_TEXT +LIRC.User1 KEY_PROG1 +LIRC.User2 KEY_PROG2 +LIRC.User3 KEY_PROG3 +LIRC.User4 KEY_PROG4 +LIRC.User5 KEY_AUDIO +LIRC.User6 KEY_VIDEO +LIRC.User7 KEY_IMAGES +LIRC.User8 KEY_FN +LIRC.User9 KEY_SCREEN + +XKeySym.Up Up +XKeySym.Down Down +XKeySym.Menu Home +XKeySym.Menu Tab +XKeySym.Menu KP_Home +XKeySym.Ok Return +XKeySym.Ok KP_Enter +XKeySym.Back BackSpace +XKeySym.Back KP_Separator +XKeySym.Left Left +XKeySym.Right Right +XKeySym.Up KP_Up +XKeySym.Down KP_Down +XKeySym.Left KP_Left +XKeySym.Right KP_Right +XKeySym.Red F1 +XKeySym.Green F2 +XKeySym.Yellow F3 +XKeySym.Blue F4 +XKeySym.0 0 +XKeySym.1 1 +XKeySym.2 2 +XKeySym.3 3 +XKeySym.4 4 +XKeySym.5 5 +XKeySym.6 6 +XKeySym.7 7 +XKeySym.8 8 +XKeySym.9 9 +XKeySym.0 KP_0 +XKeySym.1 KP_1 +XKeySym.2 KP_2 +XKeySym.3 KP_3 +XKeySym.4 KP_4 +XKeySym.5 KP_5 +XKeySym.6 KP_6 +XKeySym.7 KP_7 +XKeySym.8 KP_8 +XKeySym.9 KP_9 +XKeySym.Info End +XKeySym.Info KP_End +XKeySym.Pause F9 +XKeySym.FastFwd F6 +XKeySym.FastRew F5 +XKeySym.Power Pause +XKeySym.Volume+ F12 +XKeySym.Volume- F11 +XKeySym.Volume+ KP_Add +XKeySym.Volume- KP_Subtract +XKeySym.Mute F10 +XKeySym.User1 F5 +XKeySym.User2 F6 +XKeySym.User3 F7 +XKeySym.User4 F8 +XKeySym.User5 Print +XKeySym.User6 Scroll_Lock +XKeySym.User7 Insert +XKeySym.User8 KP_Divide +XKeySym.User9 KP_Multiply +XKeySym.Audio Menu +XKeySym.Channel+ Prior +XKeySym.Channel- Next +XKeySym.Channel+ KP_Prior +XKeySym.Channel- KP_Next +XKeySym.Volume+ XF86AudioRaiseVolume +XKeySym.Volume- XF86AudioLowerVolume +XKeySym.Mute XF86AudioMute +XKeySym.Stop XF86AudioStop +XKeySym.Play/Pause XF86AudioPlay +XKeySym.Prev XF86AudioPrev +XKeySym.Next XF86AudioNext diff --git a/roles/vdr/tasks/main.yml b/roles/vdr/tasks/main.yml index 327cdeb..7cb0c46 100644 --- a/roles/vdr/tasks/main.yml +++ b/roles/vdr/tasks/main.yml @@ -10,7 +10,6 @@ - vdr - vdrctl - vdr-plugin-dbus2vdr - - name: add svdrp to /etc/services lineinfile: dest: /etc/services @@ -22,7 +21,6 @@ dest: /etc/services state: present line: "svdrp-disc 6419/udp" - - name: create vdr recdir file: state: directory @@ -52,7 +50,6 @@ vdr.hide_first_recording_level # TODO: set recdir, user etc. in /etc/vdr/conf.d/ - - name: apt | install additional vdr plugins apt: name: '{{ item }}' @@ -61,17 +58,26 @@ with_items: '{{ vdr_plugins | default({}) }}' notify: [ 'Restart VDR' ] - - name: ensure vdr is stopped systemd: name: vdr.service state: stopped notify: [ 'Start VDR' ] -- name: 'vdr configuration | expand template for remote.conf' - template: - src: templates/remote.conf.j2 - dest: '/var/lib/vdr/remote.conf' +- name: "vdr configuration | copy remote.conf if it doesn't exist yet" + copy: + src: files/remote.conf + dest: '{{ vdr.confdir }}/remote.conf' owner: '{{ vdr.user }}' group: '{{ vdr.group }}' mode: 0644 + force: no + +- name: "vdr configuration | copy keymacros.conf if it doesn't exist yet" + copy: + src: files/keymacros.conf + dest: '{{ vdr.confdir }}/keymacros.conf' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + mode: 0644 + force: no diff --git a/roles/yavdr-common/defaults/main.yml b/roles/yavdr-common/defaults/main.yml index 17c5dac..197cbcd 100644 --- a/roles/yavdr-common/defaults/main.yml +++ b/roles/yavdr-common/defaults/main.yml @@ -1,7 +1,6 @@ --- # file: roles/yavdr-common/defaults/main.yml - branch: unstable repositories: - 'ppa:yavdr/main' @@ -9,16 +8,13 @@ repositories: - 'ppa:yavdr/{{branch}}-vdr' - 'ppa:yavdr/{{branch}}-kodi' - 'ppa:yavdr/{{branch}}-yavdr' - drivers: sundtek: auto ddvb-dkms: auto - extra_packages: - vim - tree - w-scan - vdr: user: vdr group: vdr diff --git a/roles/yavdr-common/tasks/main.yml b/roles/yavdr-common/tasks/main.yml index 96268d5..c6a5e41 100644 --- a/roles/yavdr-common/tasks/main.yml +++ b/roles/yavdr-common/tasks/main.yml @@ -4,12 +4,10 @@ template: src: templates/90-norecommends.j2 dest: /etc/apt/apt.conf.d/90norecommends - - name: use bash instead of dash shell: | echo "set dash/sh false" | debconf-communicate dpkg-reconfigure -f noninteractive dash - - name: create vdr group group: gid: '{{ vdr.gid }}' @@ -25,7 +23,6 @@ shell: '/bin/bash' state: present append: true - - name: disable release-upgrade notifications lineinfile: dest: /etc/update-manager/release-upgrades @@ -33,7 +30,6 @@ state: present regexp: '^(Prompt=).*$' line: '\1never' - - name: add yaVDR PPAs apt_repository: repo: '{{ item }}' @@ -45,7 +41,6 @@ apt: upgrade: dist update_cache: yes - - name: apt | install basic packages apt: name: '{{ item }}' @@ -55,7 +50,7 @@ - anacron - at - bash-completion - - biosdevname + #- biosdevname # caution: may change device names after a minimal installation! - debconf-utils - linux-firmware - psmisc @@ -68,7 +63,6 @@ - wpasupplicant - usbutils - xfsprogs - - name: apt | install extra packages apt: name: '{{ item }}' @@ -76,7 +70,6 @@ install_recommends: no with_items: '{{ extra_packages }}' - - name: get information about usb and pci hardware and loaded kernel modules hardware_facts: usb: True @@ -95,7 +88,6 @@ - debug: var: gpus verbosity: 1 - - name: create media directories file: dest: '{{ item.value }}' diff --git a/roles/yavdr-network/avahi/service.j2 b/roles/yavdr-network/avahi/service.j2 new file mode 100644 index 0000000..cef3154 --- /dev/null +++ b/roles/yavdr-network/avahi/service.j2 @@ -0,0 +1,11 @@ + + + +{{ item.value|capitalize }} on %h ## Name + + _nfs._tcp + 2049 + path={{ item.value }} ## path to shared Folder + subtype={% 'vdr' if item == 'recordings' else item %} ## subtype + + diff --git a/roles/yavdr-network/tasks/main.yml b/roles/yavdr-network/tasks/main.yml index 6f9e8e7..879191d 100644 --- a/roles/yavdr-network/tasks/main.yml +++ b/roles/yavdr-network/tasks/main.yml @@ -21,7 +21,7 @@ # register: wol # with_items: '{% for interface in ansible_interfaces if interface != 'lo' and interface != 'bond0' %}' -- name: restart autofs +- name: restart autofs if running systemd: name: autofs state: restarted @@ -35,6 +35,13 @@ enabled: yes masked: no +- name: restart avahi-linker if running + systemd: + name: avahi-linker + state: restarted + enabled: yes + masked: no + - name: start avahi-linker systemd: name: avahi-linker diff --git a/roles/yavdr-remote/tasks/main.yml b/roles/yavdr-remote/tasks/main.yml index eafe769..beec35c 100644 --- a/roles/yavdr-remote/tasks/main.yml +++ b/roles/yavdr-remote/tasks/main.yml @@ -13,6 +13,17 @@ when: - install_lircd is defined and install_lircd +- name: disable lircd.socket and lircd.service (conflict with eventlircd with default configuration) + systemd: + name: '{{ item }}' + enabled: no + state: stopped + masked: yes + with_items: + - lircd.service + - lircd.socket + ignore_errors: yes + - name: install eventlircd apt: name: eventlircd @@ -20,6 +31,7 @@ when: install_eventlircd is defined and install_eventlircd + # TODO: upload lircd2uinput package to PPA #- name: install lircd2uinput # tag: install diff --git a/roles/yavdr-xorg/tasks/main.yml b/roles/yavdr-xorg/tasks/main.yml index f27ff63..9a84288 100644 --- a/roles/yavdr-xorg/tasks/main.yml +++ b/roles/yavdr-xorg/tasks/main.yml @@ -43,6 +43,7 @@ - openbox - tmux - kiosk-browser + - read-edid #- yavdr-xorg - name: "stop x@vt7.service" @@ -55,6 +56,11 @@ src: "templates/systemd/system/x-verbose@.service.j2" dest: "/etc/systemd/system/x-verbose@.service" +- name: "expand template for xorg-verbose.conf" + template: + src: "templates/xorg-verbose.conf.j2" + dest: "/etc/X11/xorg-verbose.conf" + - name: "start x-verbose@.service" systemd: name: "x-verbose@vt7.service" @@ -70,6 +76,13 @@ - name: "detect xorg configuration" action: xrandr_facts +- debug: + var: xorg.primary + +- debug: + var: xorg.secondary + when: xorg.secondary is defined + - name: "stop x-verbose@vt7.service" systemd: name: "x-verbose@vt7.service" @@ -78,6 +91,11 @@ masked: true ### TODO: Create xorg configuration +- name: create xorg.conf (test) + template: + src: templates/xorg.conf.j2 + dest: /etc/X11/xorg.conf + backup: yes - name: create folders for user session file: diff --git a/roles/yavdr-xorg/templates/openbox/autostart.j2 b/roles/yavdr-xorg/templates/openbox/autostart.j2 index 160c8e3..3aa47c8 100755 --- a/roles/yavdr-xorg/templates/openbox/autostart.j2 +++ b/roles/yavdr-xorg/templates/openbox/autostart.j2 @@ -1,5 +1,4 @@ #!/bin/bash - # forward environment variables to an environment file and the systemd user session env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env systemctl --user import-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS diff --git a/roles/yavdr-xorg/templates/openbox/rc.xml.j2 b/roles/yavdr-xorg/templates/openbox/rc.xml.j2 index d866a8c..9936f5c 100644 --- a/roles/yavdr-xorg/templates/openbox/rc.xml.j2 +++ b/roles/yavdr-xorg/templates/openbox/rc.xml.j2 @@ -798,7 +798,7 @@ no true - yes + no no diff --git a/roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 b/roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 index 028dc95..9848570 100644 --- a/roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 +++ b/roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 @@ -5,4 +5,4 @@ Before=graphical.target [Service] Type=forking -ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I +ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I -config /etc/X11/xorg-debug.conf diff --git a/roles/yavdr-xorg/templates/systemd/vdr-environ.j2 b/roles/yavdr-xorg/templates/systemd/vdr-environ.j2 new file mode 100644 index 0000000..a00d7ba --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/vdr-environ.j2 @@ -0,0 +1,2 @@ +[Service] +EnvironmentFile=-/var/lib/vdr/.session-env diff --git a/roles/yavdr-xorg/templates/xorg-verbose.conf.j2 b/roles/yavdr-xorg/templates/xorg-verbose.conf.j2 new file mode 100644 index 0000000..bc15d63 --- /dev/null +++ b/roles/yavdr-xorg/templates/xorg-verbose.conf.j2 @@ -0,0 +1,20 @@ +Section "Device" + Identifier "nvidia" + Driver "nvidia" + Option "NoLogo" "true" + Option "DynamicTwinView" "true" + Option "NoFlip" "false" +# Option "FlatPanelProperties" "Scaling = Native" +# Option "ModeValidation" "NoVesaModes, NoXServerModes" +# Option "ModeDebug" "true" +# Option "HWCursor" "false" +EndSection + +Section "Screen" + Identifier "screen" + Device "nvidia" +EndSection + +Section "Extensions" + Option "Composite" "false" +EndSection diff --git a/roles/yavdr-xorg/templates/xorg.conf.j2 b/roles/yavdr-xorg/templates/xorg.conf.j2 new file mode 100644 index 0000000..6478da8 --- /dev/null +++ b/roles/yavdr-xorg/templates/xorg.conf.j2 @@ -0,0 +1,98 @@ +{{ ansible_managed_file | comment }} + +Section "ServerLayout" + Identifier "Layout0" + Screen 0 "Screen0" +{% if xorg.secondary is defined %} + Screen 1 "Screen1" RightOf "Screen0" +{% endif %} + #InputDevice "Keyboard0" "CoreKeyboard" + #InputDevice "Mouse0" "CorePointer" +EndSection + +Section "InputClass" + Identifier "exclude eventlircd devices" + MatchTag "eventlircd" + Option "Ignore" "True" +EndSection + +Section "Monitor" + Identifier "Monitor0" + VendorName "{{ xorg.primary.vendor }}" + ModelName "{{ xorg.primary.model }}" + Option "DPMS" + Option "ExactModeTimingsDVI" "True" +EndSection + +Section "Device" + Identifier "Device0" + Driver "nvidia" + VendorName "NVIDIA Corporation" + Option "NoLogo" "true" +{% if xorg.primary.bus_id is defined %} + BoardName "{{ xorg.primary.gpu_name }}" + BusID "{{ xorg.primary.bus_id }}" +{% else %} + BoardName "Unknown" +{% endif %} + Screen 0 +EndSection + + +Section "Screen" + Identifier "Screen0" + Device "Device0" + Monitor "Monitor0" + DefaultDepth 24 + Option "nvidiaXineramaInfoOrder" "{{ xorg.primary.connector }}" + Option "ConnectedMonitor" "{{ xorg.primary.connector }}" + Option "UseDisplayDevice" "{{ xorg.primary.connector }}" + Option "CustomEDID" "{{ xorg.primary.connector }}:/etc/X11/edid.{{ xorg.primary.connector }}.bin" + Option "metamodes" "{{ xorg.primary.connector }}: {{ xorg.primary.mode }} +0+0" + Option "SLI" "Off" + Option "MultiGPU" "Off" + Option "BaseMosaic" "off" + SubSection "Display" + Depth 24 + EndSubSection +EndSection + +{% if xorg.secondary is defined %} +Section "Device" + Identifier "Device1" + Driver "nvidia" + VendorName "NVIDIA Corporation" + Option "NoLogo" "true" +{% if xorg.secondary.bus_id is defined %} + BoardName "{{ xorg.primary.gpu_name }}" + BusID "{{ xorg.primary.bus_id }}" +{% else %} + BoardName "Unknown" +{% endif %} + Screen 1 +EndSection + +Section "Monitor" + Identifier "Monitor1" + VendorName "{{ xorg.secondary.vendor }}" + ModelName "{{ xorg.secondary.model }}" +EndSection + +Section "Screen" + Identifier "Screen1" + Device "Device1" + Monitor "Monitor1" + DefaultDepth 24 + Option "nvidiaXineramaInfoOrder" "{{ xorg.secondary.connector }}" + Option "ConnectedMonitor" "{{ xorg.secondary.connector }}" + Option "UseDisplayDevice" "{{ xorg.secondary.connector }}" + Option "CustomEDID" "{{ xorg.secondary.connector }}:/etc/X11/edid.{{ xorg.secondary.connector }}.bin" + Option "metamodes" "{{ xorg.secondary.connector }}: {{ xorg.secondary.mode }} +0+0" + Option "SLI" "Off" + Option "MultiGPU" "Off" + Option "BaseMosaic" "off" + SubSection "Display" + Depth 24 + EndSubSection +EndSection +{% endif %}