From 5e5f9f346a328411df63043e48844e7888e6b917 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Tue, 20 Jun 2017 15:09:15 +0200 Subject: [PATCH 01/23] add xorg configuration and driver autodetection --- Manual.org | 1424 ++++++++++++++--- group_vars/all | 1 + handlers/main.yml | 1 + install-yavdr.sh | 1 + library/hardware_facts.py | 5 +- library/satip_facts.py | 1 + library/xrandr_facts.py | 6 + localhost_inventory | 1 + roles/autoinstall-dvbhddevice/tasks/main.yml | 1 + roles/autoinstall-dvbsddevice/tasks/main.yml | 1 + roles/autoinstall-imonlcd/tasks/main.yml | 1 + roles/autoinstall-libcecdaemon/tasks/main.yml | 1 + roles/autoinstall-pvr350/tasks/main.yml | 1 + roles/autoinstall-satip/tasks/main.yml | 1 + roles/autoinstall-targavfd/tasks/main.yml | 1 + .../autoinstall-ubuntu-drivers/tasks/main.yml | 17 + roles/dvd/tasks/main.yml | 16 + roles/grub-config/defaults/main.yml | 1 + roles/grub-config/handlers/main.yml | 1 + roles/grub-config/tasks/main.yml | 1 + roles/grub-config/templates/50_custom.j2 | 1 + roles/kodi/tasks/main.yml | 25 + roles/kodi/templates/kodi.service.j2 | 13 + roles/nfs-server/tasks/main.yml | 1 + roles/nfs-server/templates/nfs-exports.j2 | 1 + roles/samba-config/tasks/main.yml | 3 +- roles/samba-config/templates/smb.conf.j2 | 1 + roles/samba-install/tasks/main.yml | 1 + roles/template-test/defaults/main.yml | 1 + roles/template-test/tasks/main.yml | 1 + roles/vdr/tasks/main.yml | 1 + roles/yavdr-common/defaults/main.yml | 9 +- roles/yavdr-common/tasks/main.yml | 6 +- .../yavdr-common/templates/90-norecommends.j2 | 1 + roles/yavdr-network/main.yml | 1 + roles/yavdr-network/tasks/main.yml | 5 +- roles/yavdr-xorg/read_xrandr.py | 51 + roles/yavdr-xorg/tasks/main.yml | 64 +- roles/yavdr-xorg/templates/.xinitrc.j2 | 1 + roles/yavdr-xorg/templates/autostart.j2 | 10 +- roles/yavdr-xorg/templates/openbox_rc.xml.j2 | 816 ++++++++++ roles/yavdr-xorg/templates/vdr-xorg.conf | 3 +- .../templates/x-verbose@.service.j2 | 1 + .../templates/yavdr-desktop.target.j2 | 7 + yavdr07-headless.yml | 1 + yavdr07.yml | 4 + 46 files changed, 2313 insertions(+), 199 deletions(-) create mode 100644 roles/autoinstall-ubuntu-drivers/tasks/main.yml create mode 100644 roles/dvd/tasks/main.yml create mode 100644 roles/kodi/tasks/main.yml create mode 100644 roles/kodi/templates/kodi.service.j2 create mode 100644 roles/yavdr-xorg/read_xrandr.py create mode 100644 roles/yavdr-xorg/templates/openbox_rc.xml.j2 create mode 100644 roles/yavdr-xorg/templates/yavdr-desktop.target.j2 diff --git a/Manual.org b/Manual.org index 2119276..9d0a47c 100644 --- a/Manual.org +++ b/Manual.org @@ -9,20 +9,97 @@ #+HTML_HEAD: #+OPTIONS: ^:nil #+PROPERTY: header-args :mkdirp yes +#+TITLE: Ansible Playbooks for yaVDR 0.7 +#+Author: Alexander Grothe :END: +* User Stories +** yavdr-full +A User wants to install yaVDR without customization and relies on full automation. + +After installing a supported Ubuntu Server version and (if needed) setting up the network connection, the install script is downloaded and started. + +The install script adds the ansible PPA, installs ansible and other basic dependencies and runs the automated installation process. + +Several roles are used to tie everything together: +- yavdr-common :: installs the basic set of packages needed and preconfigures the system (package sources, package manager settings, entires for network ports, directory structure etc.). Also collects information about the system +- autoinstall-ubuntu-drivers :: uses Ubuntu's automatic detection for additional drivers (e.g. proprietary nvidia driver, microcode updates, VirtualBox guest additions) +- vdr :: install the vdr package and required plugins +- yavdr-network :: configure WOL, add nfs client capabilites, install avahi-linker +- samba-server :: install and preconfigure a samba server +- nfs-server :: install nfs-kernelserver and preconfigure nfs exports (and avahi-announcements) +- autoinstall-satip :: install vdr-plugin-satip if a Sat>IP server has been found +- autoinstall-targavfd :: install vdr-plugin-targavfd if display is connected +- autoinstall-imonlcd :: install vdr-plugin-imonlcd if a matchind display is connected +- yavdr-xorg :: install and configure a systemd user session with a running X-server. A frontend script will manage VDR's frontend and other applications like KODI. Also choose the best possible output plugin. +- grub-config :: update grub configuration based on executed roles + +*** Using vdr, pulseaudio and xorg together + * Notes :PROPERTIES: :export nil -:END: +:END: ** TODO [#A] optimize and document data structure for xorg parsing script ** TODO [#A] xorg.conf templates for intel, nvidia, noveau and radeon drivers +*** STARTED BusID für (nvidia) Grafikkarten aus lspci auslesen +Format: "%d:%d:%d" (lspci liefert es als "%04x:%02x:%02x.%x", domain, bus, device, function) +- Wie mit mehreren GPUs umgehen? Priorität bzw. Reihenfolge? +- Was ist mit NVidia Optimus/Bumblebee (AFAIK keine VDPAU-Funktionalität)? +- 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, + +"%d@%d:%d:%d", bus, domain, device, function +in printf(3) syntax. NVIDIA X driver logging, nvidia-xconfig, and nvidia-settings match the X configuration file BusID convention. + +The lspci(8) utility, in contrast, reports the PCI BusID of a PCI device in the format "domain:bus:device.function", printing the values in hexadecimal. More specifically, + +"%04x:%02x:%02x.%x", domain, bus, device, function +in printf(3) syntax. The "Bus Location" reported in the /proc/driver/nvidia/gpus/0..N/information files matches the lspci format. +**** Parsen der /proc/driver/nvidia/gpus/*/information Dateien +#+BEGIN_SRC python + # read the BusID for nvidia cards and the model name from the /proc/driver/nvidia/gpus/*/information file(s) + from __future__ import print_function + import glob + import re + + BusID_RE = re.compile(( + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + '\.' + '(?P[0-9a-fA-F]+)' + )) + Model_RE = re.compile('Model:\s+(.*)') + + def get_BusIDs(): + for gpu_info in glob.glob('/proc/driver/nvidia/gpus/*/information'): + with open(gpu_info) as f: + data = f.read() + match = BusID_RE.search(data) + if match: + BusID = "{:d}@{:d}:{:d}:{:d}".format(*(int(n, 16) for n in match.groups())) + yield BusID, Model_RE.match(data).groups()[0] + if __name__ == '__main__': + BusIDs = [BusID for BusID in get_BusIDs()] + print(BusIDs) +#+END_SRC ** TODO [#B] plan for customization of xorg settings by the user either directly or using a configuration wizard or a web frontend ** SOMEDAY [#C] select best frontend based on GPU - intel :: softhddevice-vpp - amd :: softhddevice-vpp - nvidia :: softhddevice-openglosd (if no HEVC channels are needed) + +* Introduction +One of the major problems we faced with customized Ubuntu ISO files as installation media for prior yaVDR versions has been the limited hardware support and the time consuming process to create and update them. An interesting alternative to this approach is to enable the user to choose the installation medium himself so point releases, kernel versions and additional drivers can be chosen deliberately. After the basic setup is complete (and a working internet connection is available), a fully customizable install script completes the yaVDR installation. * Installing and configuring yaVDR with Ansible This is an experimental feature which allows to set up a yaVDR installation based on a normal Ubuntu Server 16.04.x installation using [[http://ansible.com][Ansible]]. @@ -67,6 +144,7 @@ The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation: become: true roles: - yavdr-common # install and configure the basic system + - autoinstall-ubuntu-drivers # use ubuntu-drivers to install proprietary dirvers (e.g. nvidia, virtualbox) - vdr # install vdr and related packages - yavdr-network # enable network client capabilities - samba-install # install samba server @@ -79,6 +157,8 @@ The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation: - autoinstall-imonlcd # install vdr-plugin-imonlcd if a matchind display is connected #- autoinstall-pv350 # install vdr-plugin-pvr350 if a matching card is detected #- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected + - kodi + - dvd - grub-config # configure grub handlers: @@ -115,7 +195,7 @@ localhost connection=local #+END_SRC * Group Variables -** default text for templates +** default text for templates used by ansible #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes # file: group_vars/all @@ -124,15 +204,15 @@ ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***" #+END_SRC ** PPAs #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes -branch: unstable -ppa_owner: 'ppa:yavdr' -# a list of all package repositories to be added to the installation -repositories: - - '{{ ppa_owner }}/main' - - '{{ ppa_owner }}/unstable-main' - - '{{ ppa_owner }}/{{branch}}-vdr' - - '{{ ppa_owner }}/{{branch}}-yavdr' - - '{{ ppa_owner }}/{{branch}}-kodi' + branch: unstable + ppa_owner: 'ppa:yavdr' + # a list of all package repositories to be added to the installation + repositories: + - '{{ ppa_owner }}/main' + - '{{ ppa_owner }}/unstable-main' + - '{{ ppa_owner }}/{{branch}}-vdr' + - '{{ ppa_owner }}/{{branch}}-yavdr' + - '{{ ppa_owner }}/{{branch}}-kodi' #+END_SRC ** VDR user, directories, special configuration and plugins #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes @@ -196,6 +276,43 @@ grub: boot_options: quiet nosplash #+END_SRC * Roles +** install-dependencies +*** tasks +**** main.yml +#+BEGIN_SRC yaml :tangle roles/install-packages/tasks/main.yml :mkdirp yes +--- + +- name: apt | install packages + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + '{{ packages }}' +#+END_SRC + +** nvidia-381 drivers +install nvidia-381 from ppa:graphics-drivers/ppa +*** tasks +**** main.yml +#+BEGIN_SRC yaml :tangle roles/nvidia-381/tasks/main.yml :mkdirp yes +--- + +- name: add ppa:graphics-drivers/ppa + apt_repository: + repo: 'ppa:graphics-drivers/ppa' + state: present + update_cache: yes + +- name: install nvidia-381 and other required packages + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - nvidia-381 + - nvidia-settings +#+END_SRC ** yavdr-common This role is used to set up a basic yaVDR installation. It creates the directories, installs the vdr and other useful packages. *** default variables @@ -257,12 +374,6 @@ vdr: *** tasks yavdr-common executes the following tasks: **** main.yml - #+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :exports none :mkdirp yes ---- - -# This playbook sets up the basic packages an directories for a yaVDR installation -# file: roles/yavdr-common/tasks/main.yml - #+END_SRC ***** Disable default installation of recommended packages This task prevents apt to automatically install all recommended dependencies for packages: #+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes @@ -335,6 +446,7 @@ yavdr-common executes the following tasks: - at - bash-completion - biosdevname + - debconf-utils - linux-firmware - psmisc - python-kmodpy @@ -342,7 +454,6 @@ yavdr-common executes the following tasks: - python3-usb - software-properties-common - ssh - - ubuntu-drivers-common - wget - wpasupplicant - usbutils @@ -483,8 +594,8 @@ install_avahi: true #+BEGIN_SRC yaml :tangle roles/yavdr-network/tasks/main.yml :mkdirp yes --- # this playbook sets up network services for a yaVDR installation -# -- name: install network packages + +- name: apt |install packages for network services apt: name: '{{ item }}' state: present @@ -505,18 +616,30 @@ install_avahi: true # with_items: '{% for interface in ansible_interfaces if interface != 'lo' and interface != 'bond0' %}' #+END_SRC -** STARTED nfs-server +** nfs-server *** tasks -#+BEGIN_SRC yaml :tanlge roles/nfs-server/tasks/main.yml :mkdirp yes -- name: install and configure nfs-kernel-server +#+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes +- name: install nfs server packages apt: - name: "{{ item }}" - state: present - install_recommends: no + name: '{{ item }}' + state: present + install_recommends: no with_items: - - nfs-kernel-server - when: - - '{{ install_nfs_server }}' + - nfs-kernel-server + - nfs-common + +- name: create /etc/exports + template: + src: templates/nfs-exports.j2 + dest: /etc/exports + notify: [ 'Restart NFS Kernel Server' ] +#+END_SRC +*** templates +#+BEGIN_SRC conf :tangle roles/nfs-server/templates/nfs-exports.j2 :mkdirp yes + /srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) + {% for name, path in media_dirs.iteritems() %} + {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) + {% endfor %} #+END_SRC ** TODO yavdr-remote *** default variables @@ -603,7 +726,6 @@ Section "Monitor" EndSection #+END_SRC - **** DONE Start X-server with debug-output #+BEGIN_SRC conf # /etc/systemd/system/x-debug@.service @@ -913,6 +1035,26 @@ b'\xde\xad\xbe\xef' --- # file: roles/yavdr-xorg/tasks/main.yml + +# TODO: use hooks or requirements instead +- name: Stop VDR + systemd: + name: vdr.service + state: stopped + enabled: yes + notify: ['Start VDR'] + +- name: Stop xlogin + systemd: + name: xlogin@vdr.service + state: stopped + enabled: yes + +- name: Stop x + systemd: + name: x@vt7.service + state: stopped + - name: install packages for xorg apt: name: '{{ item }}' @@ -969,7 +1111,7 @@ b'\xde\xad\xbe\xef' group: '{{ vdr.group }}' with_items: - '{{ vdr.home }}/.config/systemd/user' - - '{{ vdr.home }}/.config/openbox/autostart' + - '{{ vdr.home }}/.config/openbox/' ### TODO: move to yavdr-xorg package? ### - name: create folder for customizations of vdr.service @@ -978,6 +1120,22 @@ b'\xde\xad\xbe\xef' dest: /etc/systemd/system/vdr.service.d mode: '0775' +- name: create folder for systemd user configuration + file: + state: directory + dest: '{{ vdr.home }}/.config/systemd/user' + mode: '0775' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + +- name: create folder for openbox configuration + file: + state: directory + dest: '{{ vdr.home }}/.config/openbox' + mode: '0775' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + - name: add dependency to X-server for vdr.service using a drop-in template: src: templates/vdr-xorg.conf @@ -987,7 +1145,7 @@ b'\xde\xad\xbe\xef' - name: create .xinitrc for vdr user template: src: 'templates/.xinitrc.j2' - dest: '/var/lib/vdr/.xinitrc' + dest: '{{ vdr.home }}/.xinitrc' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' @@ -995,7 +1153,23 @@ b'\xde\xad\xbe\xef' - name: populate autostart for openbox template: src: 'templates/autostart.j2' - dest: '/var/lib/vdr/.config/openbox/autostart' + dest: '{{ vdr.home }}/.config/openbox/autostart' + mode: 0755 + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + +- name: expand rc.xml for openbox + template: + src: 'templates/openbox_rc.xml.j2' + dest: '{{ vdr.home }}/.config/openbox/rc.xml' + mode: 0755 + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + +- name: create yavdr.target for the user session + template: + src: 'templates/yavdr-desktop.target.j2' + dest: '{{ vdr.home }}/.config/systemd/user/yavdr-desktop.target' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' @@ -1040,14 +1214,28 @@ ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I [Unit] After=x@vt7.service Wants=x@vt7.service -BindsTo=x@vt7.service +#BindsTo=x@vt7.service #+END_SRC #+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/.xinitrc.j2 :mkdirp yes #!/bin/bash # {{ ansible_managed_file }} exec openbox-session #+END_SRC -#+BEGIN_SRC shell tangle: ansible/yavdr-ansible/roles/yavdr-xorg/templates/autostart.j2 :mkdirp yes + +#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/yavdr-desktop.target.j2 :mkdirp yes +[Unit] +Description=yaVDR Desktop +Requires=default.target +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 +**** openbox +****** autostart +#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/autostart.j2 :mkdirp yes 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 @@ -1055,42 +1243,829 @@ if which dbus-update-activation-environment >/dev/null 2>&1; then dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR fi -### -# Needed to start pulseaudio before VDR if softhddevice is attached at startup -# (so the frontend-skript can't force pulseaudio to free the soundcard) -### -# pactl list sinks 2>&1 >> /tmp/audio.dbg +# start systemd units for the yavdr user session +systemctl --user isolate yavdr-desktop.target +#+END_SRC +****** rc.xml +#+BEGIN_SRC xml :tangle roles/yavdr-xorg/templates/openbox_rc.xml.j2 :mkdirp yes :padline no + + + + + 10 + 20 + + + yes + + no + + yes + + no + + 200 + + no + + + + Smart + +
yes
+ + Active + + Active + +
+ + Onyx + NLIMC + + yes + yes + + sans + 8 + + bold + + normal + + + + sans + 8 + + bold + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + bold + + normal + + + + sans + 9 + + bold + + normal + + + + + + 2 + 1 + + + + 875 + + + + yes + Nonpixel + + Center + + + + 10 + + 10 + + + + + + 0 + 0 + 0 + 0 + + + TopLeft + + 0 + 0 + no + Above + + Vertical + + no + 300 + + 300 + + Middle + + + + C-g + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + + + + + client-menu + + + + + + scrot -s + + + + + + + + + + + + + + + + + + + + + + + + yes + yes + + + + + + + + + + + right + + + + + left + + + + + up + + + + + down + + + + + + + true + Konqueror + + kfmclient openProfile filemanagement + + + + + + scrot + + + + + 1 + + 500 + + 400 + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + no + + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + top + + + + + + + left + + + + + + + right + + + + + + + bottom + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vertical + + + + + horizontal + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + + + + client-list-combined-menu + + + + + root-menu + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + + no + + 100 + + 400 + + yes + + yes + + + + + + no + true + + yes + + + no + true + + yes + + + no + true + + yes + + +
#+END_SRC -#+BEGIN_SRC conf :tangle roles/yavdr-org/templates/xorg.conf.yavdr :mkdirp yes - -#+END_SRC -** nfs-server -*** tasks -#+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes -- name: install nfs server packages - apt: - name: '{{ item }}' - state: present - install_recommends: no - with_items: - - nfs-kernel-server - - nfs-common - -- name: create /etc/exports - template: - src: templates/nfs-exports.j2 - dest: /etc/exports - notify: [ 'Restart NFS Kernel Server' ] -#+END_SRC -*** templates -#+BEGIN_SRC conf :tangle roles/nfs-server/templates/nfs-exports.j2 :mkdirp yes -/srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) -{% for name, path in media_dirs.iteritems() %} -{{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) -{% endfor %} -#+END_SRC -** nfs-config ** samba-install *** tasks #+BEGIN_SRC yaml :tangle roles/samba-install/tasks/main.yml :mkdirp yes @@ -1114,7 +2089,7 @@ fi # file: roles/samba-config/tasks/main.yml # TODO: -#- name: divert original smbd.conf +# - name: divert original smbd.conf - name: touch smb.conf.custom file: @@ -1235,7 +2210,7 @@ fi #+BEGIN_SRC yaml :tangle roles/samba-config/templates/smb.conf.j2 :mkdirp yes include = /etc/samba/smb.conf.custom #+END_SRC -** TODO autoinstall-drivers +** 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) Vendor-IDs: @@ -1246,7 +2221,29 @@ Vendor-IDs: *** 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 +The tool ubuntu-drivers is used to install the matching driver version for nvidia graphics cards, virtualbox guest additions and Intel and AMD microcode updates. +*** tasks +#+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml + --- + # file roles/autoinstall-ubuntu-drivers/tasks/main.yml + + - name: apt | install ubuntu-drivers-common + apt: + name: ubuntu-drivers-common + state: present + + - name: ensure /etc/yavdr exists + file: + path: /etc/yavdr + state: directory + mode: 0755 + + - name: let ubuntu-drivers automatically install additional drivers + command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall +#+END_SRC ** autoinstall-satip +If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip is installed. *** tasks #+BEGIN_SRC yaml :tangle roles/autoinstall-satip/tasks/main.yml --- @@ -1348,6 +2345,73 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll - '"dvb_ttpci" in modules' notify: [ 'Restart VDR' ] #+END_SRC +** dvd +*** tasks +**** install libdvd-pkg +#+BEGIN_SRC yaml :tangle roles/dvd/tasks/main.yml :mkdirp yes +--- +# file: roles/dvd/tasks/main.yml + +- name: preconfigure libdvd-pkg + shell: | + echo 'libdvd-pkg libdvd-pkg/post-invoke_hook-install boolean true' | debconf-set-selections + echo 'libdvd-pkg libdvd-pkg/build boolean true' | debconf-set-selections + +- name: apt | install libdvd-pkg + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - libdvd-pkg +#+END_SRC + +** kodi +*** tasks +**** Install KODI +#+BEGIN_SRC yaml :tangle roles/kodi/tasks/main.yml :mkdirp yes +--- + +- name: change udev rule to allow KODI to eject optical disks + shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules + args: + creates: /etc/udev/rules.d/60-cdrom_id.rules + +- name: apt | install kodi packages + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - kodi + - kodi-pvr-vdr-vnsi + - kodi-eventclients-xbmc-send + +- name: create kodi.service for the user session + template: + src: 'templates/kodi.service.j2' + dest: '{{ vdr.home }}/.config/systemd/user/kodi.service' + mode: 0755 + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + +#+END_SRC +*** templates +**** kodi.service +#+BEGIN_SRC conf :tangle roles/kodi/templates/kodi.service.j2 :mkdirp yes +[Unit] +Description=Start kodi in user session + +[Service] +Type=simple +PassEnvironment=DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +ExecStartPre=-/usr/bin/set-kodi-display +ExecStart=/usr/bin/kodi +ExecStop=/bin/bash -c "/usr/bin/kodi-send --action=QUIT; while /usr/bin/pgrep kodi; do sleep 1; done; sleep 1" +TimeoutStopSec=10 +SuccessExitStatus=0 127 +Restart=on-failure +#+END_SRC ** template-test #+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml --- @@ -1643,132 +2707,132 @@ fi This section contains custom modules for the yaVDR Playbooks. They are used to collect facts about the system and configure applications and daemons. ** hardware_facts.py #+BEGIN_SRC python :tangle library/hardware_facts.py -#!/usr/bin/env python + #!/usr/bin/env python -# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. -DOCUMENTATION = ''' ---- -module: hardware_facts -short_description: collects facts for kernel modules, usb and pci devices -description: - - This Module collects the vendor- and device ids for USB- and PCI(e)-devices and - currently loaded kernel modules. -options: - usb: - required: False - default: True - description: - - return a list of vendor- and device ids for usb devices in '04x:04x' notation + # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. + DOCUMENTATION = ''' + --- + module: hardware_facts + short_description: collects facts for kernel modules, usb and pci devices + description: + - This Module collects the vendor- and device ids for USB- and PCI(e)-devices and + currently loaded kernel modules. + options: + usb: + required: False + default: True + description: + - return a list of vendor- and device ids for usb devices in '04x:04x' notation - pci: - required: False - default: True - description: - - return a list of vendor- and device ids for pci devices in '04x:04x' notation + pci: + required: False + default: True + description: + - return a list of vendor- and device ids for pci devices in '04x:04x' notation - modules: - required: False - default: True - description: - - return a list of currently loaded kernel modules + modules: + required: False + default: True + description: + - return a list of currently loaded kernel modules - gpus: - required: False - default: True - description: - - return a list of devices of the pci gpu class (0x030000) -notes: - - requres python-pyusb and python-kmodpy -requirements: [ ] -author: "Alexander Grothe " -''' + gpus: + required: False + default: True + description: + - return a list of devices of the pci gpu class (0x030000) + notes: + - requres python-pyusb and python-kmodpy + requirements: [ ] + author: "Alexander Grothe " + ''' -EXAMPLES = ''' -- name: get information about usb and pci hardware and loaded kernel modules - hardware_facts: - usb: True - pci: True - modules: True -- debug: - var: usb -- debug - var: pci -- debug - var: modules -- debug - var: gpus -''' + EXAMPLES = ''' + - name: get information about usb and pci hardware and loaded kernel modules + hardware_facts: + usb: True + pci: True + modules: True + - debug: + var: usb + - debug + var: pci + - debug + var: modules + - debug + var: gpus + ''' -import glob -import json -import os -import sys -import usb.core -from collections import namedtuple + import glob + import json + import os + import sys + import usb.core + from collections import namedtuple -import kmodpy -from ansible.module_utils.basic import * + import kmodpy + from ansible.module_utils.basic import * -PCIDevice = namedtuple("PCIDevice", ['idVendor', 'idProduct', 'idClass']) + PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') -def get_pci_devices(): - for device in glob.glob('/sys/devices/pci*/*:*:*/'): - with open(os.path.join(device, 'device')) as d: - product_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'vendor')) as d: - vendor_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'class')) as d: - class_id = int(d.read().strip(), 16) - yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id) + def get_pci_devices(): + for device in glob.glob('/sys/devices/pci*/*:*:*/'): + with open(os.path.join(device, 'device')) as d: + product_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'vendor')) as d: + vendor_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'class')) as d: + class_id = int(d.read().strip(), 16) + yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) -def format_device_list(iterator): - return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] + def format_device_list(iterator): + return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] -def format_gpu_device_list(iterator): - def get_entries(iterator): - for d in iterator: - if d.idClass == 0x030000: - yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) - return [entry for entry in get_entries(iterator)] + def format_gpu_device_list(iterator): + def get_entries(iterator): + for d in iterator: + if d.idClass == 0x030000: + yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) + return [entry for entry in get_entries(iterator)] -arg_specs = { - 'usb': dict(default=True, type='bool', required=False), - 'pci': dict(default=True, type='bool', required=False), - 'modules': dict(default=True, type='bool', required=False), - 'gpus': dict(default=True, type='bool', required=False), - } + arg_specs = { + 'usb': dict(default=True, type='bool', required=False), + 'pci': dict(default=True, type='bool', required=False), + 'modules': dict(default=True, type='bool', required=False), + 'gpus': dict(default=True, type='bool', required=False), + } -def main(): - module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) - collect_usb = module.params['usb'] - collect_pci = module.params['pci'] - collect_modules = module.params['modules'] - collect_gpus = module.params['gpus'] - if collect_usb: - usb_devices = format_device_list(usb.core.find(find_all=True)) - else: - usb_device = [] - if collect_pci: - pci_devices = format_device_list(get_pci_devices()) - else: - pci_devices = [] - if collect_modules: - k = kmodpy.Kmod() - modules = [m[0] for m in k.loaded()] - else: - modules = [] - if collect_gpus: - gpus = format_gpu_device_list(get_pci_devices()) - else: - gpus = [] - data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} - module.exit_json(changed=False, ansible_facts=data, msg=data) + def main(): + module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) + collect_usb = module.params['usb'] + collect_pci = module.params['pci'] + collect_modules = module.params['modules'] + collect_gpus = module.params['gpus'] + if collect_usb: + usb_devices = format_device_list(usb.core.find(find_all=True)) + else: + usb_device = [] + if collect_pci: + pci_devices = format_device_list(get_pci_devices()) + else: + pci_devices = [] + if collect_modules: + k = kmodpy.Kmod() + modules = [m[0] for m in k.loaded()] + else: + modules = [] + if collect_gpus: + gpus = format_gpu_device_list(get_pci_devices()) + else: + gpus = [] + data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} + module.exit_json(changed=False, ansible_facts=data, msg=data) -if __name__ == '__main__': - main() + if __name__ == '__main__': + main() #+END_SRC ** satip_facts.py #+BEGIN_SRC python :tangle library/satip_facts.py diff --git a/group_vars/all b/group_vars/all index dd92388..d6db646 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1,3 +1,4 @@ + # file: group_vars/all # this is the standard text to put in templates diff --git a/handlers/main.yml b/handlers/main.yml index 840b674..d7fd733 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,3 +1,4 @@ + - name: Restart Samba systemd: name: smbd.service diff --git a/install-yavdr.sh b/install-yavdr.sh index d3bd2d8..d8aa931 100755 --- a/install-yavdr.sh +++ b/install-yavdr.sh @@ -1,4 +1,5 @@ #!/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 30bca4f..4eb11f0 100644 --- a/library/hardware_facts.py +++ b/library/hardware_facts.py @@ -1,3 +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. @@ -65,7 +66,7 @@ import kmodpy from ansible.module_utils.basic import * -PCIDevice = namedtuple("PCIDevice", ['idVendor', 'idProduct', 'idClass']) +PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') def get_pci_devices(): for device in glob.glob('/sys/devices/pci*/*:*:*/'): @@ -75,7 +76,7 @@ def get_pci_devices(): vendor_id = int(d.read().strip(), 16) with open(os.path.join(device, 'class')) as d: class_id = int(d.read().strip(), 16) - yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id) + yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) def format_device_list(iterator): return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] diff --git a/library/satip_facts.py b/library/satip_facts.py index 7b2d4c5..0025178 100644 --- a/library/satip_facts.py +++ b/library/satip_facts.py @@ -1,3 +1,4 @@ + #!/usr/bin/env python2 DOCUMENTATION = ''' diff --git a/library/xrandr_facts.py b/library/xrandr_facts.py index b8a47bd..4bcbfb9 100644 --- a/library/xrandr_facts.py +++ b/library/xrandr_facts.py @@ -1,3 +1,4 @@ + #!/usr/bin/env python2 from __future__ import print_function import ast @@ -42,6 +43,11 @@ options: default: ["7680x4320", "3840x2160", "1920x1080", "1280x720", "720x576"] description: - ranking of the preferred display resolutions + write_edids: + required: False + default: True + description: + - write edid data to /etc/X11/edid.{connector}.bin ''' EXAMPLES = ''' - name: "collect facts for connected displays" diff --git a/localhost_inventory b/localhost_inventory index a51c139..9974433 100644 --- a/localhost_inventory +++ b/localhost_inventory @@ -1,2 +1,3 @@ + [localhost] localhost connection=local diff --git a/roles/autoinstall-dvbhddevice/tasks/main.yml b/roles/autoinstall-dvbhddevice/tasks/main.yml index 0c6bb22..c697e93 100644 --- a/roles/autoinstall-dvbhddevice/tasks/main.yml +++ b/roles/autoinstall-dvbhddevice/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file roles/autoinstall-dvbhddevice/tasks/main.yml diff --git a/roles/autoinstall-dvbsddevice/tasks/main.yml b/roles/autoinstall-dvbsddevice/tasks/main.yml index 78a7243..ef4fbad 100644 --- a/roles/autoinstall-dvbsddevice/tasks/main.yml +++ b/roles/autoinstall-dvbsddevice/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file roles/autoinstall-dvbsddevice/tasks/main.yml diff --git a/roles/autoinstall-imonlcd/tasks/main.yml b/roles/autoinstall-imonlcd/tasks/main.yml index d5bae07..bf16cb9 100644 --- a/roles/autoinstall-imonlcd/tasks/main.yml +++ b/roles/autoinstall-imonlcd/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file roles/autoinstall-imonlcd/tasks/main.yml diff --git a/roles/autoinstall-libcecdaemon/tasks/main.yml b/roles/autoinstall-libcecdaemon/tasks/main.yml index 131abf7..38d55a2 100644 --- a/roles/autoinstall-libcecdaemon/tasks/main.yml +++ b/roles/autoinstall-libcecdaemon/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file roles/autoinstall-libcec-daemon/tasks/main.yml diff --git a/roles/autoinstall-pvr350/tasks/main.yml b/roles/autoinstall-pvr350/tasks/main.yml index 6a25230..f61142d 100644 --- a/roles/autoinstall-pvr350/tasks/main.yml +++ b/roles/autoinstall-pvr350/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file roles/autoinstall-pvr350/tasks/main.yml diff --git a/roles/autoinstall-satip/tasks/main.yml b/roles/autoinstall-satip/tasks/main.yml index 9b3733d..9e6b9df 100644 --- a/roles/autoinstall-satip/tasks/main.yml +++ b/roles/autoinstall-satip/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file roles/autoinstall-satip/tasks/main.yml diff --git a/roles/autoinstall-targavfd/tasks/main.yml b/roles/autoinstall-targavfd/tasks/main.yml index fd30030..071a8c4 100644 --- a/roles/autoinstall-targavfd/tasks/main.yml +++ b/roles/autoinstall-targavfd/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file roles/autoinstall-targavfd/tasks/main.yml diff --git a/roles/autoinstall-ubuntu-drivers/tasks/main.yml b/roles/autoinstall-ubuntu-drivers/tasks/main.yml new file mode 100644 index 0000000..f538585 --- /dev/null +++ b/roles/autoinstall-ubuntu-drivers/tasks/main.yml @@ -0,0 +1,17 @@ + +--- +# file roles/autoinstall-ubuntu-drivers/tasks/main.yml + +- name: apt | install ubuntu-drivers-common + apt: + name: ubuntu-drivers-common + state: present + +- name: ensure /etc/yavdr exists + file: + path: /etc/yavdr + state: directory + mode: 0755 + +- name: let ubuntu-drivers automatically install additional drivers + command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall diff --git a/roles/dvd/tasks/main.yml b/roles/dvd/tasks/main.yml new file mode 100644 index 0000000..c789213 --- /dev/null +++ b/roles/dvd/tasks/main.yml @@ -0,0 +1,16 @@ + +--- +# file: roles/dvd/tasks/main.yml + +- name: preconfigure libdvd-pkg + shell: | + echo 'libdvd-pkg libdvd-pkg/post-invoke_hook-install boolean true' | debconf-set-selections + echo 'libdvd-pkg libdvd-pkg/build boolean true' | debconf-set-selections + +- name: apt | install libdvd-pkg + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - libdvd-pkg diff --git a/roles/grub-config/defaults/main.yml b/roles/grub-config/defaults/main.yml index 61b5b5a..f7a6ab4 100644 --- a/roles/grub-config/defaults/main.yml +++ b/roles/grub-config/defaults/main.yml @@ -1,3 +1,4 @@ + system: shutdown: poweroff grub: diff --git a/roles/grub-config/handlers/main.yml b/roles/grub-config/handlers/main.yml index a7e3e2c..354640d 100644 --- a/roles/grub-config/handlers/main.yml +++ b/roles/grub-config/handlers/main.yml @@ -1,3 +1,4 @@ + - name: Update GRUB command: update-grub failed_when: ('error' in grub_register_update.stderr) diff --git a/roles/grub-config/tasks/main.yml b/roles/grub-config/tasks/main.yml index 6a24bad..1268ffe 100644 --- a/roles/grub-config/tasks/main.yml +++ b/roles/grub-config/tasks/main.yml @@ -1,3 +1,4 @@ + - name: custom grub configuration for timeout and reboot halt template: src: templates/50_custom.j2 diff --git a/roles/grub-config/templates/50_custom.j2 b/roles/grub-config/templates/50_custom.j2 index 74a944b..079cee9 100644 --- a/roles/grub-config/templates/50_custom.j2 +++ b/roles/grub-config/templates/50_custom.j2 @@ -1,3 +1,4 @@ + #!/bin/sh exec tail -n +3 $0 diff --git a/roles/kodi/tasks/main.yml b/roles/kodi/tasks/main.yml new file mode 100644 index 0000000..0dca20e --- /dev/null +++ b/roles/kodi/tasks/main.yml @@ -0,0 +1,25 @@ + +--- + +- name: change udev rule to allow KODI to eject optical disks + shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules + args: + creates: /etc/udev/rules.d/60-cdrom_id.rules + +- name: apt | install kodi packages + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - kodi + - kodi-pvr-vdr-vnsi + - kodi-eventclients-xbmc-send + +- name: create kodi.service for the user session + template: + src: 'templates/kodi.service.j2' + dest: '{{ vdr.home }}/.config/systemd/user/kodi.service' + mode: 0755 + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' diff --git a/roles/kodi/templates/kodi.service.j2 b/roles/kodi/templates/kodi.service.j2 new file mode 100644 index 0000000..a508b24 --- /dev/null +++ b/roles/kodi/templates/kodi.service.j2 @@ -0,0 +1,13 @@ + +[Unit] +Description=Start kodi in user session + +[Service] +Type=simple +PassEnvironment=DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +ExecStartPre=-/usr/bin/set-kodi-display +ExecStart=/usr/bin/kodi +ExecStop=/bin/bash -c "/usr/bin/kodi-send --action=QUIT; while /usr/bin/pgrep kodi; do sleep 1; done; sleep 1" +TimeoutStopSec=10 +SuccessExitStatus=0 127 +Restart=on-failure diff --git a/roles/nfs-server/tasks/main.yml b/roles/nfs-server/tasks/main.yml index cc0be13..c047b03 100644 --- a/roles/nfs-server/tasks/main.yml +++ b/roles/nfs-server/tasks/main.yml @@ -1,3 +1,4 @@ + - name: install nfs server packages apt: name: '{{ item }}' diff --git a/roles/nfs-server/templates/nfs-exports.j2 b/roles/nfs-server/templates/nfs-exports.j2 index eabb162..42f6913 100644 --- a/roles/nfs-server/templates/nfs-exports.j2 +++ b/roles/nfs-server/templates/nfs-exports.j2 @@ -1,3 +1,4 @@ + /srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) {% for name, path in media_dirs.iteritems() %} {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) diff --git a/roles/samba-config/tasks/main.yml b/roles/samba-config/tasks/main.yml index e9388da..ccbd7f7 100644 --- a/roles/samba-config/tasks/main.yml +++ b/roles/samba-config/tasks/main.yml @@ -1,7 +1,8 @@ + # file: roles/samba-config/tasks/main.yml # TODO: -#- name: divert original smbd.conf +# - name: divert original smbd.conf - name: touch smb.conf.custom file: diff --git a/roles/samba-config/templates/smb.conf.j2 b/roles/samba-config/templates/smb.conf.j2 index befd2b7..aae856f 100644 --- a/roles/samba-config/templates/smb.conf.j2 +++ b/roles/samba-config/templates/smb.conf.j2 @@ -1,3 +1,4 @@ + {{ ansible_managed_file | comment }} #======================= Global Settings ======================= diff --git a/roles/samba-install/tasks/main.yml b/roles/samba-install/tasks/main.yml index 2c6358a..a51e3fe 100644 --- a/roles/samba-install/tasks/main.yml +++ b/roles/samba-install/tasks/main.yml @@ -1,3 +1,4 @@ + # file: roles/samba-install/tasks/main.yml - name: install samba server diff --git a/roles/template-test/defaults/main.yml b/roles/template-test/defaults/main.yml index da426aa..efd58a0 100644 --- a/roles/template-test/defaults/main.yml +++ b/roles/template-test/defaults/main.yml @@ -1,3 +1,4 @@ + foo: - bar - baz diff --git a/roles/template-test/tasks/main.yml b/roles/template-test/tasks/main.yml index a2a30b2..6e321e9 100644 --- a/roles/template-test/tasks/main.yml +++ b/roles/template-test/tasks/main.yml @@ -1,3 +1,4 @@ + --- - name: show vars debug: diff --git a/roles/vdr/tasks/main.yml b/roles/vdr/tasks/main.yml index e4b3c69..71f9293 100644 --- a/roles/vdr/tasks/main.yml +++ b/roles/vdr/tasks/main.yml @@ -1,3 +1,4 @@ + --- # file: roles/vdr/tasks/main.yml diff --git a/roles/yavdr-common/defaults/main.yml b/roles/yavdr-common/defaults/main.yml index 1f53b94..64ccb77 100644 --- a/roles/yavdr-common/defaults/main.yml +++ b/roles/yavdr-common/defaults/main.yml @@ -1,3 +1,4 @@ + --- # file: roles/yavdr-common/defaults/main.yml @@ -13,10 +14,10 @@ drivers: sundtek: auto ddvb-dkms: auto - extra_packages: - - vim - - tree - - w-scan +extra_packages: + - vim + - tree + - w-scan vdr: user: vdr diff --git a/roles/yavdr-common/tasks/main.yml b/roles/yavdr-common/tasks/main.yml index 6b809e9..4d5c5f4 100644 --- a/roles/yavdr-common/tasks/main.yml +++ b/roles/yavdr-common/tasks/main.yml @@ -1,7 +1,3 @@ ---- - -# This playbook sets up the basic packages an directories for a yaVDR installation -# file: roles/yavdr-common/tasks/main.yml - name: apt | prevent automatic installation of recommended packages template: @@ -59,6 +55,7 @@ - at - bash-completion - biosdevname + - debconf-utils - linux-firmware - psmisc - python-kmodpy @@ -66,7 +63,6 @@ - python3-usb - software-properties-common - ssh - - ubuntu-drivers-common - wget - wpasupplicant - usbutils diff --git a/roles/yavdr-common/templates/90-norecommends.j2 b/roles/yavdr-common/templates/90-norecommends.j2 index e58919b..5263087 100644 --- a/roles/yavdr-common/templates/90-norecommends.j2 +++ b/roles/yavdr-common/templates/90-norecommends.j2 @@ -1,3 +1,4 @@ + {{ ansible_managed_file | comment('c') }} // Recommends are as of now still abused in many packages APT::Install-Recommends "0"; diff --git a/roles/yavdr-network/main.yml b/roles/yavdr-network/main.yml index 8db1b64..b69c9b5 100644 --- a/roles/yavdr-network/main.yml +++ b/roles/yavdr-network/main.yml @@ -1 +1,2 @@ + install_avahi: true diff --git a/roles/yavdr-network/tasks/main.yml b/roles/yavdr-network/tasks/main.yml index b058c4e..6ad1c23 100644 --- a/roles/yavdr-network/tasks/main.yml +++ b/roles/yavdr-network/tasks/main.yml @@ -1,7 +1,8 @@ + --- # this playbook sets up network services for a yaVDR installation -# -- name: install network packages + +- name: apt |install packages for network services apt: name: '{{ item }}' state: present diff --git a/roles/yavdr-xorg/read_xrandr.py b/roles/yavdr-xorg/read_xrandr.py new file mode 100644 index 0000000..9626568 --- /dev/null +++ b/roles/yavdr-xorg/read_xrandr.py @@ -0,0 +1,51 @@ +#!/usr/bin/ env python3 +import subprocess + + +xrandr_data = subprocess.check_output(['xrandr', '-q'], universal_newlines=True) + + +def print_modelines(resolutions): + if resolutions: + for resolution, refreshrates in reversed(sorted(resolutions.items())): + for refreshrate in refreshrates: + print("{}_{}".format(resolution, refreshrate)) + + +def cleanup_refreshrate(refreshrate): + return refreshrate.replace('+', '').replace('*', '') + +resolutions = {} +for line in xrandr_data.splitlines(): + if line.startswith('Screen'): + print_modelines(resolutions) + new_connection = False + screen = line.split(':', maxsplit=1)[0].split()[-1] + new_screen = True + print('Screen: {}'.format(screen)) + + elif new_screen and not new_connection and ' connected ' in line: + connection = line.split()[0] + new_screen = False + new_connection = True + print('Connection: {}'.format(connection)) + resolutions = {} + + elif new_connection and line.startswith(' '): + resolution, *refreshrates = line.split() + res_x, res_y = resolution.split('x') + resolution = (int(res_x), int(res_y)) + r = [] + for refreshrate in refreshrates: + if '+' in refreshrate: + current_mode = (resolution, + cleanup_refreshrate(refreshrate)) + print('Current Mode: {}@{}'.format(*current_mode)) + if '*' in refreshrate: + preferred_mode = (resolution, + cleanup_refreshrate(refreshrate)) + print('Preferred Mode: {}@{}'.format(*preferred_mode)) + r.append(cleanup_refreshrate(refreshrate)) + resolutions[resolution] = r + +print_modelines(resolutions) diff --git a/roles/yavdr-xorg/tasks/main.yml b/roles/yavdr-xorg/tasks/main.yml index ef66c5c..4cf9ddd 100644 --- a/roles/yavdr-xorg/tasks/main.yml +++ b/roles/yavdr-xorg/tasks/main.yml @@ -1,6 +1,27 @@ + --- # file: roles/yavdr-xorg/tasks/main.yml + +# TODO: use hooks or requirements instead +- name: Stop VDR + systemd: + name: vdr.service + state: stopped + enabled: yes + notify: ['Start VDR'] + +- name: Stop xlogin + systemd: + name: xlogin@vdr.service + state: stopped + enabled: yes + +- name: Stop x + systemd: + name: x@vt7.service + state: stopped + - name: install packages for xorg apt: name: '{{ item }}' @@ -57,7 +78,7 @@ group: '{{ vdr.group }}' with_items: - '{{ vdr.home }}/.config/systemd/user' - - '{{ vdr.home }}/.config/openbox/autostart' + - '{{ vdr.home }}/.config/openbox/' ### TODO: move to yavdr-xorg package? ### - name: create folder for customizations of vdr.service @@ -66,6 +87,22 @@ dest: /etc/systemd/system/vdr.service.d mode: '0775' +- name: create folder for systemd user configuration + file: + state: directory + dest: '{{ vdr.home }}/.config/systemd/user' + mode: '0775' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + +- name: create folder for openbox configuration + file: + state: directory + dest: '{{ vdr.home }}/.config/openbox' + mode: '0775' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + - name: add dependency to X-server for vdr.service using a drop-in template: src: templates/vdr-xorg.conf @@ -75,7 +112,7 @@ - name: create .xinitrc for vdr user template: src: 'templates/.xinitrc.j2' - dest: '/var/lib/vdr/.xinitrc' + dest: '{{ vdr.home }}/.xinitrc' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' @@ -83,7 +120,23 @@ - name: populate autostart for openbox template: src: 'templates/autostart.j2' - dest: '/var/lib/vdr/.config/openbox/autostart' + dest: '{{ vdr.home }}/.config/openbox/autostart' + mode: 0755 + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + +- name: expand rc.xml for openbox + template: + src: 'templates/openbox_rc.xml.j2' + dest: '{{ vdr.home }}/.config/openbox/rc.xml' + mode: 0755 + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + +- name: create yavdr.target for the user session + template: + src: 'templates/yavdr-desktop.target.j2' + dest: '{{ vdr.home }}/.config/systemd/user/yavdr-desktop.target' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' @@ -97,6 +150,11 @@ groups: '{{ vdr.group }}' append: yes +# TODO: run xorg-debug and parse xrandr output +# TODO: expand template for xorg.conf (or snippets) +# with respect for the available graphics card driver +# nvidia, noveau, intel, radeon + - name: enable and start xlogin for the user vdr systemd: daemon_reload: yes diff --git a/roles/yavdr-xorg/templates/.xinitrc.j2 b/roles/yavdr-xorg/templates/.xinitrc.j2 index deb9862..37b71fa 100644 --- a/roles/yavdr-xorg/templates/.xinitrc.j2 +++ b/roles/yavdr-xorg/templates/.xinitrc.j2 @@ -1,3 +1,4 @@ + #!/bin/bash # {{ ansible_managed_file }} exec openbox-session diff --git a/roles/yavdr-xorg/templates/autostart.j2 b/roles/yavdr-xorg/templates/autostart.j2 index cf7a3dc..6b6c0d7 100644 --- a/roles/yavdr-xorg/templates/autostart.j2 +++ b/roles/yavdr-xorg/templates/autostart.j2 @@ -1,2 +1,10 @@ + env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env -systemctl --user import-environment +systemctl --user import-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS + +if which dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR +fi + +# start systemd units for the yavdr user session +systemctl --user isolate yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/openbox_rc.xml.j2 b/roles/yavdr-xorg/templates/openbox_rc.xml.j2 new file mode 100644 index 0000000..d866a8c --- /dev/null +++ b/roles/yavdr-xorg/templates/openbox_rc.xml.j2 @@ -0,0 +1,816 @@ + + + + + 10 + 20 + + + yes + + no + + yes + + no + + 200 + + no + + + + Smart + +
yes
+ + Active + + Active + +
+ + Onyx + NLIMC + + yes + yes + + sans + 8 + + bold + + normal + + + + sans + 8 + + bold + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + bold + + normal + + + + sans + 9 + + bold + + normal + + + + + + 2 + 1 + + + + 875 + + + + yes + Nonpixel + + Center + + + + 10 + + 10 + + + + + + 0 + 0 + 0 + 0 + + + TopLeft + + 0 + 0 + no + Above + + Vertical + + no + 300 + + 300 + + Middle + + + + C-g + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + + + + + client-menu + + + + + + scrot -s + + + + + + + + + + + + + + + + + + + + + + + + yes + yes + + + + + + + + + + + right + + + + + left + + + + + up + + + + + down + + + + + + + true + Konqueror + + kfmclient openProfile filemanagement + + + + + + scrot + + + + + 1 + + 500 + + 400 + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + no + + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + top + + + + + + + left + + + + + + + right + + + + + + + bottom + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vertical + + + + + horizontal + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + + + + client-list-combined-menu + + + + + root-menu + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + + no + + 100 + + 400 + + yes + + yes + + + + + + no + true + + yes + + + no + true + + yes + + + no + true + + yes + + +
diff --git a/roles/yavdr-xorg/templates/vdr-xorg.conf b/roles/yavdr-xorg/templates/vdr-xorg.conf index 73ca70f..94c2104 100644 --- a/roles/yavdr-xorg/templates/vdr-xorg.conf +++ b/roles/yavdr-xorg/templates/vdr-xorg.conf @@ -1,7 +1,8 @@ + # file: roles/yavdr-xorg/templates/vdr-xorg.conf # {{ ansible_managed_file }} [Unit] After=x@vt7.service Wants=x@vt7.service -BindsTo=x@vt7.service +#BindsTo=x@vt7.service diff --git a/roles/yavdr-xorg/templates/x-verbose@.service.j2 b/roles/yavdr-xorg/templates/x-verbose@.service.j2 index 028dc95..eb7f0c2 100644 --- a/roles/yavdr-xorg/templates/x-verbose@.service.j2 +++ b/roles/yavdr-xorg/templates/x-verbose@.service.j2 @@ -1,3 +1,4 @@ + [Unit] Description=X with verbose logging on %I Wants=graphical.target diff --git a/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 b/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 new file mode 100644 index 0000000..72a9ab6 --- /dev/null +++ b/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 @@ -0,0 +1,7 @@ + +[Unit] +Description=yaVDR Desktop +Requires=default.target +After=default.target pulseaudio.service +Wants=dbus.service pulseaudio.service +AllowIsolate=yes diff --git a/yavdr07-headless.yml b/yavdr07-headless.yml index 9de97fc..f465b4d 100644 --- a/yavdr07-headless.yml +++ b/yavdr07-headless.yml @@ -1,3 +1,4 @@ + --- # file: yavdr07-headless.yml # this playbook set up a headless yaVDR 0.7 installation diff --git a/yavdr07.yml b/yavdr07.yml index 0ee68c0..a2ef381 100644 --- a/yavdr07.yml +++ b/yavdr07.yml @@ -1,3 +1,4 @@ + --- # file: yavdr07.yml # this playbook sets up a complete yaVDR 0.7 installation @@ -7,6 +8,7 @@ become: true roles: - yavdr-common # install and configure the basic system + - autoinstall-ubuntu-drivers # use ubuntu-drivers to install proprietary dirvers (e.g. nvidia, virtualbox) - vdr # install vdr and related packages - yavdr-network # enable network client capabilities - samba-install # install samba server @@ -19,6 +21,8 @@ - autoinstall-imonlcd # install vdr-plugin-imonlcd if a matchind display is connected #- autoinstall-pv350 # install vdr-plugin-pvr350 if a matching card is detected #- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected + - kodi + - dvd - grub-config # configure grub handlers: From ddf59c34f168f961596d824a040b3562bd7b717b Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Tue, 20 Jun 2017 16:19:08 +0200 Subject: [PATCH 02/23] Cleanup empty lines at beginning of file --- group_vars/all | 1 - handlers/main.yml | 1 - install-yavdr.sh | 1 - library/hardware_facts.py | 219 ++- library/satip_facts.py | 1 - library/xrandr_facts.py | 1 - localhost_inventory | 1 - roles/autoinstall-dvbhddevice/tasks/main.yml | 1 - roles/autoinstall-dvbsddevice/tasks/main.yml | 1 - roles/autoinstall-imonlcd/tasks/main.yml | 1 - roles/autoinstall-libcecdaemon/tasks/main.yml | 1 - roles/autoinstall-pvr350/tasks/main.yml | 1 - roles/autoinstall-satip/tasks/main.yml | 1 - roles/autoinstall-targavfd/tasks/main.yml | 1 - .../autoinstall-ubuntu-drivers/tasks/main.yml | 27 +- roles/dvd/tasks/main.yml | 1 - roles/grub-config/defaults/main.yml | 1 - roles/grub-config/handlers/main.yml | 1 - roles/grub-config/tasks/main.yml | 1 - roles/grub-config/templates/50_custom.j2 | 1 - roles/kodi/tasks/main.yml | 1 - roles/kodi/templates/kodi.service.j2 | 1 - roles/nfs-server/tasks/main.yml | 1 - roles/nfs-server/templates/nfs-exports.j2 | 9 +- roles/samba-config/tasks/main.yml | 1 - roles/samba-config/templates/smb.conf.j2 | 1 - roles/samba-install/tasks/main.yml | 1 - roles/template-test/defaults/main.yml | 1 - roles/template-test/tasks/main.yml | 1 - roles/template-test/vars/main.yml | 5 - roles/vdr/tasks/main.yml | 1 - roles/yavdr-common/defaults/main.yml | 9 +- roles/yavdr-common/files/90-norecommends.j2 | 4 - roles/yavdr-common/tasks/main.yml | 1 - .../yavdr-common/templates/90-norecommends.j2 | 1 - roles/yavdr-network/main.yml | 1 - roles/yavdr-network/tasks/main.yml | 1 - roles/yavdr-xorg/tasks/main.yml | 1 - roles/yavdr-xorg/templates/.xinitrc.j2 | 1 - roles/yavdr-xorg/templates/autostart.j2 | 1 - roles/yavdr-xorg/templates/openbox_rc.xml.j2 | 1538 ++++++++--------- roles/yavdr-xorg/templates/vdr-xorg.conf | 1 - .../yavdr-xorg/templates/x-verbose.service.j2 | 8 - .../templates/x-verbose@.service.j2 | 1 - .../templates/yavdr-desktop.target.j2 | 1 - yavdr07.yml | 1 - 46 files changed, 899 insertions(+), 958 deletions(-) delete mode 100644 roles/template-test/vars/main.yml delete mode 100644 roles/yavdr-common/files/90-norecommends.j2 delete mode 100644 roles/yavdr-xorg/templates/x-verbose.service.j2 diff --git a/group_vars/all b/group_vars/all index d6db646..dd92388 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1,4 +1,3 @@ - # file: group_vars/all # this is the standard text to put in templates 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 4eb11f0..ef58f76 100644 --- a/library/hardware_facts.py +++ b/library/hardware_facts.py @@ -1,127 +1,126 @@ + #!/usr/bin/env python -#!/usr/bin/env python + # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. + DOCUMENTATION = ''' + --- + module: hardware_facts + short_description: collects facts for kernel modules, usb and pci devices + description: + - This Module collects the vendor- and device ids for USB- and PCI(e)-devices and + currently loaded kernel modules. + options: + usb: + required: False + default: True + description: + - return a list of vendor- and device ids for usb devices in '04x:04x' notation -# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. -DOCUMENTATION = ''' ---- -module: hardware_facts -short_description: collects facts for kernel modules, usb and pci devices -description: - - This Module collects the vendor- and device ids for USB- and PCI(e)-devices and - currently loaded kernel modules. -options: - usb: - required: False - default: True - description: - - return a list of vendor- and device ids for usb devices in '04x:04x' notation + pci: + required: False + default: True + description: + - return a list of vendor- and device ids for pci devices in '04x:04x' notation - pci: - required: False - default: True - description: - - return a list of vendor- and device ids for pci devices in '04x:04x' notation + modules: + required: False + default: True + description: + - return a list of currently loaded kernel modules - modules: - required: False - default: True - description: - - return a list of currently loaded kernel modules + gpus: + required: False + default: True + description: + - return a list of devices of the pci gpu class (0x030000) + notes: + - requres python-pyusb and python-kmodpy + requirements: [ ] + author: "Alexander Grothe " + ''' - gpus: - required: False - default: True - description: - - return a list of devices of the pci gpu class (0x030000) -notes: - - requres python-pyusb and python-kmodpy -requirements: [ ] -author: "Alexander Grothe " -''' + EXAMPLES = ''' + - name: get information about usb and pci hardware and loaded kernel modules + hardware_facts: + usb: True + pci: True + modules: True + - debug: + var: usb + - debug + var: pci + - debug + var: modules + - debug + var: gpus + ''' -EXAMPLES = ''' -- name: get information about usb and pci hardware and loaded kernel modules - hardware_facts: - usb: True - pci: True - modules: True -- debug: - var: usb -- debug - var: pci -- debug - var: modules -- debug - var: gpus -''' + import glob + import json + import os + import sys + import usb.core + from collections import namedtuple -import glob -import json -import os -import sys -import usb.core -from collections import namedtuple - -import kmodpy -from ansible.module_utils.basic import * + import kmodpy + from ansible.module_utils.basic import * -PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') + PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') -def get_pci_devices(): - for device in glob.glob('/sys/devices/pci*/*:*:*/'): - with open(os.path.join(device, 'device')) as d: - product_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'vendor')) as d: - vendor_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'class')) as d: - class_id = int(d.read().strip(), 16) - yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) + def get_pci_devices(): + for device in glob.glob('/sys/devices/pci*/*:*:*/'): + with open(os.path.join(device, 'device')) as d: + product_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'vendor')) as d: + vendor_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'class')) as d: + class_id = int(d.read().strip(), 16) + yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) -def format_device_list(iterator): - return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] + def format_device_list(iterator): + return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] -def format_gpu_device_list(iterator): - def get_entries(iterator): - for d in iterator: - if d.idClass == 0x030000: - yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) - return [entry for entry in get_entries(iterator)] + def format_gpu_device_list(iterator): + def get_entries(iterator): + for d in iterator: + if d.idClass == 0x030000: + yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) + return [entry for entry in get_entries(iterator)] -arg_specs = { - 'usb': dict(default=True, type='bool', required=False), - 'pci': dict(default=True, type='bool', required=False), - 'modules': dict(default=True, type='bool', required=False), - 'gpus': dict(default=True, type='bool', required=False), - } + arg_specs = { + 'usb': dict(default=True, type='bool', required=False), + 'pci': dict(default=True, type='bool', required=False), + 'modules': dict(default=True, type='bool', required=False), + 'gpus': dict(default=True, type='bool', required=False), + } -def main(): - module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) - collect_usb = module.params['usb'] - collect_pci = module.params['pci'] - collect_modules = module.params['modules'] - collect_gpus = module.params['gpus'] - if collect_usb: - usb_devices = format_device_list(usb.core.find(find_all=True)) - else: - usb_device = [] - if collect_pci: - pci_devices = format_device_list(get_pci_devices()) - else: - pci_devices = [] - if collect_modules: - k = kmodpy.Kmod() - modules = [m[0] for m in k.loaded()] - else: - modules = [] - if collect_gpus: - gpus = format_gpu_device_list(get_pci_devices()) - else: - gpus = [] - data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} - module.exit_json(changed=False, ansible_facts=data, msg=data) + def main(): + module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) + collect_usb = module.params['usb'] + collect_pci = module.params['pci'] + collect_modules = module.params['modules'] + collect_gpus = module.params['gpus'] + if collect_usb: + usb_devices = format_device_list(usb.core.find(find_all=True)) + else: + usb_device = [] + if collect_pci: + pci_devices = format_device_list(get_pci_devices()) + else: + pci_devices = [] + if collect_modules: + k = kmodpy.Kmod() + modules = [m[0] for m in k.loaded()] + else: + modules = [] + if collect_gpus: + gpus = format_gpu_device_list(get_pci_devices()) + else: + gpus = [] + data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} + module.exit_json(changed=False, ansible_facts=data, msg=data) -if __name__ == '__main__': - main() + if __name__ == '__main__': + main() diff --git a/library/satip_facts.py b/library/satip_facts.py index 0025178..7b2d4c5 100644 --- a/library/satip_facts.py +++ b/library/satip_facts.py @@ -1,4 +1,3 @@ - #!/usr/bin/env python2 DOCUMENTATION = ''' diff --git a/library/xrandr_facts.py b/library/xrandr_facts.py index 4bcbfb9..f9cf680 100644 --- a/library/xrandr_facts.py +++ b/library/xrandr_facts.py @@ -1,4 +1,3 @@ - #!/usr/bin/env python2 from __future__ import print_function import ast diff --git a/localhost_inventory b/localhost_inventory index 9974433..a51c139 100644 --- a/localhost_inventory +++ b/localhost_inventory @@ -1,3 +1,2 @@ - [localhost] localhost connection=local diff --git a/roles/autoinstall-dvbhddevice/tasks/main.yml b/roles/autoinstall-dvbhddevice/tasks/main.yml index c697e93..0c6bb22 100644 --- a/roles/autoinstall-dvbhddevice/tasks/main.yml +++ b/roles/autoinstall-dvbhddevice/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file roles/autoinstall-dvbhddevice/tasks/main.yml diff --git a/roles/autoinstall-dvbsddevice/tasks/main.yml b/roles/autoinstall-dvbsddevice/tasks/main.yml index ef4fbad..78a7243 100644 --- a/roles/autoinstall-dvbsddevice/tasks/main.yml +++ b/roles/autoinstall-dvbsddevice/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file roles/autoinstall-dvbsddevice/tasks/main.yml diff --git a/roles/autoinstall-imonlcd/tasks/main.yml b/roles/autoinstall-imonlcd/tasks/main.yml index bf16cb9..d5bae07 100644 --- a/roles/autoinstall-imonlcd/tasks/main.yml +++ b/roles/autoinstall-imonlcd/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file roles/autoinstall-imonlcd/tasks/main.yml diff --git a/roles/autoinstall-libcecdaemon/tasks/main.yml b/roles/autoinstall-libcecdaemon/tasks/main.yml index 38d55a2..131abf7 100644 --- a/roles/autoinstall-libcecdaemon/tasks/main.yml +++ b/roles/autoinstall-libcecdaemon/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file roles/autoinstall-libcec-daemon/tasks/main.yml diff --git a/roles/autoinstall-pvr350/tasks/main.yml b/roles/autoinstall-pvr350/tasks/main.yml index f61142d..6a25230 100644 --- a/roles/autoinstall-pvr350/tasks/main.yml +++ b/roles/autoinstall-pvr350/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file roles/autoinstall-pvr350/tasks/main.yml diff --git a/roles/autoinstall-satip/tasks/main.yml b/roles/autoinstall-satip/tasks/main.yml index 9e6b9df..9b3733d 100644 --- a/roles/autoinstall-satip/tasks/main.yml +++ b/roles/autoinstall-satip/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file roles/autoinstall-satip/tasks/main.yml diff --git a/roles/autoinstall-targavfd/tasks/main.yml b/roles/autoinstall-targavfd/tasks/main.yml index 071a8c4..fd30030 100644 --- a/roles/autoinstall-targavfd/tasks/main.yml +++ b/roles/autoinstall-targavfd/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file roles/autoinstall-targavfd/tasks/main.yml diff --git a/roles/autoinstall-ubuntu-drivers/tasks/main.yml b/roles/autoinstall-ubuntu-drivers/tasks/main.yml index f538585..ef82a2e 100644 --- a/roles/autoinstall-ubuntu-drivers/tasks/main.yml +++ b/roles/autoinstall-ubuntu-drivers/tasks/main.yml @@ -1,17 +1,16 @@ + --- + # file roles/autoinstall-ubuntu-drivers/tasks/main.yml ---- -# file roles/autoinstall-ubuntu-drivers/tasks/main.yml + - name: apt | install ubuntu-drivers-common + apt: + name: ubuntu-drivers-common + state: present -- name: apt | install ubuntu-drivers-common - apt: - name: ubuntu-drivers-common - state: present + - name: ensure /etc/yavdr exists + file: + path: /etc/yavdr + state: directory + mode: 0755 -- name: ensure /etc/yavdr exists - file: - path: /etc/yavdr - state: directory - mode: 0755 - -- name: let ubuntu-drivers automatically install additional drivers - command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall + - name: let ubuntu-drivers automatically install additional drivers + command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall diff --git a/roles/dvd/tasks/main.yml b/roles/dvd/tasks/main.yml index c789213..a819988 100644 --- a/roles/dvd/tasks/main.yml +++ b/roles/dvd/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file: roles/dvd/tasks/main.yml diff --git a/roles/grub-config/defaults/main.yml b/roles/grub-config/defaults/main.yml index f7a6ab4..61b5b5a 100644 --- a/roles/grub-config/defaults/main.yml +++ b/roles/grub-config/defaults/main.yml @@ -1,4 +1,3 @@ - system: shutdown: poweroff grub: diff --git a/roles/grub-config/handlers/main.yml b/roles/grub-config/handlers/main.yml index 354640d..a7e3e2c 100644 --- a/roles/grub-config/handlers/main.yml +++ b/roles/grub-config/handlers/main.yml @@ -1,4 +1,3 @@ - - name: Update GRUB command: update-grub failed_when: ('error' in grub_register_update.stderr) diff --git a/roles/grub-config/tasks/main.yml b/roles/grub-config/tasks/main.yml index 1268ffe..6a24bad 100644 --- a/roles/grub-config/tasks/main.yml +++ b/roles/grub-config/tasks/main.yml @@ -1,4 +1,3 @@ - - name: custom grub configuration for timeout and reboot halt template: src: templates/50_custom.j2 diff --git a/roles/grub-config/templates/50_custom.j2 b/roles/grub-config/templates/50_custom.j2 index 079cee9..74a944b 100644 --- a/roles/grub-config/templates/50_custom.j2 +++ b/roles/grub-config/templates/50_custom.j2 @@ -1,4 +1,3 @@ - #!/bin/sh exec tail -n +3 $0 diff --git a/roles/kodi/tasks/main.yml b/roles/kodi/tasks/main.yml index 0dca20e..971ac53 100644 --- a/roles/kodi/tasks/main.yml +++ b/roles/kodi/tasks/main.yml @@ -1,4 +1,3 @@ - --- - name: change udev rule to allow KODI to eject optical disks diff --git a/roles/kodi/templates/kodi.service.j2 b/roles/kodi/templates/kodi.service.j2 index a508b24..6549c46 100644 --- a/roles/kodi/templates/kodi.service.j2 +++ b/roles/kodi/templates/kodi.service.j2 @@ -1,4 +1,3 @@ - [Unit] Description=Start kodi in user session diff --git a/roles/nfs-server/tasks/main.yml b/roles/nfs-server/tasks/main.yml index c047b03..cc0be13 100644 --- a/roles/nfs-server/tasks/main.yml +++ b/roles/nfs-server/tasks/main.yml @@ -1,4 +1,3 @@ - - name: install nfs server packages apt: name: '{{ item }}' diff --git a/roles/nfs-server/templates/nfs-exports.j2 b/roles/nfs-server/templates/nfs-exports.j2 index 42f6913..81e8a95 100644 --- a/roles/nfs-server/templates/nfs-exports.j2 +++ b/roles/nfs-server/templates/nfs-exports.j2 @@ -1,5 +1,4 @@ - -/srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) -{% for name, path in media_dirs.iteritems() %} -{{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) -{% endfor %} + /srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) + {% for name, path in media_dirs.iteritems() %} + {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) + {% endfor %} diff --git a/roles/samba-config/tasks/main.yml b/roles/samba-config/tasks/main.yml index ccbd7f7..b1cfcb0 100644 --- a/roles/samba-config/tasks/main.yml +++ b/roles/samba-config/tasks/main.yml @@ -1,4 +1,3 @@ - # file: roles/samba-config/tasks/main.yml # TODO: diff --git a/roles/samba-config/templates/smb.conf.j2 b/roles/samba-config/templates/smb.conf.j2 index aae856f..befd2b7 100644 --- a/roles/samba-config/templates/smb.conf.j2 +++ b/roles/samba-config/templates/smb.conf.j2 @@ -1,4 +1,3 @@ - {{ ansible_managed_file | comment }} #======================= Global Settings ======================= diff --git a/roles/samba-install/tasks/main.yml b/roles/samba-install/tasks/main.yml index a51e3fe..2c6358a 100644 --- a/roles/samba-install/tasks/main.yml +++ b/roles/samba-install/tasks/main.yml @@ -1,4 +1,3 @@ - # file: roles/samba-install/tasks/main.yml - name: install samba server diff --git a/roles/template-test/defaults/main.yml b/roles/template-test/defaults/main.yml index efd58a0..da426aa 100644 --- a/roles/template-test/defaults/main.yml +++ b/roles/template-test/defaults/main.yml @@ -1,4 +1,3 @@ - foo: - bar - baz diff --git a/roles/template-test/tasks/main.yml b/roles/template-test/tasks/main.yml index 6e321e9..a2a30b2 100644 --- a/roles/template-test/tasks/main.yml +++ b/roles/template-test/tasks/main.yml @@ -1,4 +1,3 @@ - --- - name: show vars debug: diff --git a/roles/template-test/vars/main.yml b/roles/template-test/vars/main.yml deleted file mode 100644 index 0f734b8..0000000 --- a/roles/template-test/vars/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -vars: - foo: - - bar - - baz - - spam diff --git a/roles/vdr/tasks/main.yml b/roles/vdr/tasks/main.yml index 71f9293..e4b3c69 100644 --- a/roles/vdr/tasks/main.yml +++ b/roles/vdr/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file: roles/vdr/tasks/main.yml diff --git a/roles/yavdr-common/defaults/main.yml b/roles/yavdr-common/defaults/main.yml index 64ccb77..1f53b94 100644 --- a/roles/yavdr-common/defaults/main.yml +++ b/roles/yavdr-common/defaults/main.yml @@ -1,4 +1,3 @@ - --- # file: roles/yavdr-common/defaults/main.yml @@ -14,10 +13,10 @@ drivers: sundtek: auto ddvb-dkms: auto -extra_packages: - - vim - - tree - - w-scan + extra_packages: + - vim + - tree + - w-scan vdr: user: vdr diff --git a/roles/yavdr-common/files/90-norecommends.j2 b/roles/yavdr-common/files/90-norecommends.j2 deleted file mode 100644 index a4b9ce7..0000000 --- a/roles/yavdr-common/files/90-norecommends.j2 +++ /dev/null @@ -1,4 +0,0 @@ -// {{ ansible_managed_file }} -// Recommends are as of now still abused in many packages -APT::Install-Recommends "0"; -APT::Install-Suggests "0"; diff --git a/roles/yavdr-common/tasks/main.yml b/roles/yavdr-common/tasks/main.yml index 4d5c5f4..24d4dab 100644 --- a/roles/yavdr-common/tasks/main.yml +++ b/roles/yavdr-common/tasks/main.yml @@ -1,4 +1,3 @@ - - name: apt | prevent automatic installation of recommended packages template: src: templates/90-norecommends.j2 diff --git a/roles/yavdr-common/templates/90-norecommends.j2 b/roles/yavdr-common/templates/90-norecommends.j2 index 5263087..e58919b 100644 --- a/roles/yavdr-common/templates/90-norecommends.j2 +++ b/roles/yavdr-common/templates/90-norecommends.j2 @@ -1,4 +1,3 @@ - {{ ansible_managed_file | comment('c') }} // Recommends are as of now still abused in many packages APT::Install-Recommends "0"; diff --git a/roles/yavdr-network/main.yml b/roles/yavdr-network/main.yml index b69c9b5..8db1b64 100644 --- a/roles/yavdr-network/main.yml +++ b/roles/yavdr-network/main.yml @@ -1,2 +1 @@ - install_avahi: true diff --git a/roles/yavdr-network/tasks/main.yml b/roles/yavdr-network/tasks/main.yml index 6ad1c23..7efe237 100644 --- a/roles/yavdr-network/tasks/main.yml +++ b/roles/yavdr-network/tasks/main.yml @@ -1,4 +1,3 @@ - --- # this playbook sets up network services for a yaVDR installation diff --git a/roles/yavdr-xorg/tasks/main.yml b/roles/yavdr-xorg/tasks/main.yml index 4cf9ddd..ceb5782 100644 --- a/roles/yavdr-xorg/tasks/main.yml +++ b/roles/yavdr-xorg/tasks/main.yml @@ -1,4 +1,3 @@ - --- # file: roles/yavdr-xorg/tasks/main.yml diff --git a/roles/yavdr-xorg/templates/.xinitrc.j2 b/roles/yavdr-xorg/templates/.xinitrc.j2 index 37b71fa..deb9862 100644 --- a/roles/yavdr-xorg/templates/.xinitrc.j2 +++ b/roles/yavdr-xorg/templates/.xinitrc.j2 @@ -1,4 +1,3 @@ - #!/bin/bash # {{ ansible_managed_file }} exec openbox-session diff --git a/roles/yavdr-xorg/templates/autostart.j2 b/roles/yavdr-xorg/templates/autostart.j2 index 6b6c0d7..777c844 100644 --- a/roles/yavdr-xorg/templates/autostart.j2 +++ b/roles/yavdr-xorg/templates/autostart.j2 @@ -1,4 +1,3 @@ - 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..e61c42a 100644 --- a/roles/yavdr-xorg/templates/openbox_rc.xml.j2 +++ b/roles/yavdr-xorg/templates/openbox_rc.xml.j2 @@ -1,816 +1,816 @@ - - - - - 10 - 20 - - - yes - - no - - yes - - no - - 200 - - no - - - - Smart - -
yes
- - Active - - Active - -
- - Onyx - NLIMC - - yes - yes - - sans - 8 - - bold - - normal - - - - sans - 8 - - bold - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - bold - - normal - - - - sans - 9 - - bold - - normal - - - - - - 2 - 1 - - + + 10 + 20 + + + yes + + no + + yes + + no + + 200 + + no + + + + Smart + +
yes
+ + Active + + Active + +
+ + Onyx + NLIMC + -
- 875 - -
- - yes - Nonpixel - - Center - - - - 10 - - 10 - - - - - - 0 - 0 - 0 - 0 - - - TopLeft - - 0 - 0 - no - Above - - Vertical - - no - 300 - - 300 - - Middle - - - - C-g - - - - left - no - - - - - right - no - - - - - up - no - - - - - down - no - - - - - left - no - - - - - right - no - - - - - up - no - - - - - down - no - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - - - - - - - - - - - - - client-menu - - - - - - scrot -s - - - - - - - - - - - - - - - - - - - - - - - - yes - yes - - - - - - - - - - - right - - - - - left - - - - - up - - - - - down - - - - - - - true - Konqueror - - kfmclient openProfile filemanagement - - - - - - scrot - - - - - 1 - - 500 - - 400 - - false - - - - - - - - - - - - - - - - - - - - - - - - - - + yes + yes + + sans + 8 + + bold + + normal + + + + sans + 8 + + bold + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + bold + + normal + + + + sans + 9 + + bold + + normal + + + + + + 2 + 1 + + + + 875 + + + + yes + Nonpixel + + Center + + + + 10 + + 10 + + + + + + 0 + 0 + 0 + 0 + + + TopLeft + + 0 + 0 + no + Above + + Vertical + + no + 300 + + 300 + + Middle + + + + C-g + + - previous + left + no - - + + - next + right + no - - + + - previous + up + no - - + + - next + down + no - - + + - previous + left + no - - + + - next + right + no - - - - - - - - - - - - no - - - - - - + + + + up + no - - - - yes - - - - + + + + down + no - - - - - - - - - - - - - - - - - - client-menu + + + + 1 - - - - - - top + + + + 2 - - - - - - left + + + + 3 - - - - - - right + + + + 4 - - - - - - bottom - - - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - client-menu - - - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vertical - - - - - horizontal - - - - - - - - - - + + + + + + - - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - - - - - - - - - - + + + + + + + - client-list-combined-menu + client-menu - - - - root-menu + + + + + scrot -s - - - - - - previous + + + + + + + + + - - - - next + + + + + + + + - - - - previous + + + + yes + yes + + + + + - - - - next + + + + + right - - - - - - - - /var/lib/openbox/debian-menu.xml - menu.xml - 200 - - no - - 100 - - 400 - - yes - - yes - - - + + + + true + Konqueror + + kfmclient openProfile filemanagement + + + + + + scrot + + + + + 1 + + 500 + + 400 + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + no + + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + top + + + + + + + left + + + + + + + right + + + + + + + bottom + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vertical + + + + + horizontal + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + + + + client-list-combined-menu + + + + + root-menu + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + + no + + 100 + + 400 + + yes + + yes + + + - - - no true - - yes + # 'Horizontal', 'Vertical' or boolean (yes/no) - - no - true - - yes - - - no - true - - yes - - -
+ + # end of the example + --> + + + no + true + + yes + + + no + true + + yes + + + no + true + + yes + + + diff --git a/roles/yavdr-xorg/templates/vdr-xorg.conf b/roles/yavdr-xorg/templates/vdr-xorg.conf index 94c2104..be7f34b 100644 --- a/roles/yavdr-xorg/templates/vdr-xorg.conf +++ b/roles/yavdr-xorg/templates/vdr-xorg.conf @@ -1,4 +1,3 @@ - # file: roles/yavdr-xorg/templates/vdr-xorg.conf # {{ ansible_managed_file }} diff --git a/roles/yavdr-xorg/templates/x-verbose.service.j2 b/roles/yavdr-xorg/templates/x-verbose.service.j2 deleted file mode 100644 index 028dc95..0000000 --- a/roles/yavdr-xorg/templates/x-verbose.service.j2 +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=X with verbose logging on %I -Wants=graphical.target -Before=graphical.target - -[Service] -Type=forking -ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I diff --git a/roles/yavdr-xorg/templates/x-verbose@.service.j2 b/roles/yavdr-xorg/templates/x-verbose@.service.j2 index eb7f0c2..028dc95 100644 --- a/roles/yavdr-xorg/templates/x-verbose@.service.j2 +++ b/roles/yavdr-xorg/templates/x-verbose@.service.j2 @@ -1,4 +1,3 @@ - [Unit] Description=X with verbose logging on %I Wants=graphical.target diff --git a/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 b/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 index 72a9ab6..1786c7c 100644 --- a/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 +++ b/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 @@ -1,4 +1,3 @@ - [Unit] Description=yaVDR Desktop Requires=default.target diff --git a/yavdr07.yml b/yavdr07.yml index a2ef381..b4ef79e 100644 --- a/yavdr07.yml +++ b/yavdr07.yml @@ -1,4 +1,3 @@ - --- # file: yavdr07.yml # this playbook sets up a complete yaVDR 0.7 installation From b374fe4eadc0dacd58e49f0fd253e21bb7b61aa8 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Tue, 20 Jun 2017 16:20:24 +0200 Subject: [PATCH 03/23] more formatting corrections, add yavdr-remote role --- Manual.org | 53 +++++++++++++++++++++++++++++++++++--------- yavdr07-headless.yml | 1 - 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/Manual.org b/Manual.org index 9d0a47c..2c7817e 100644 --- a/Manual.org +++ b/Manual.org @@ -134,7 +134,7 @@ ansible-playbook yavdr07.yml -b -i 'localhost_inventory' --connection=local * Playbooks ** yavdr07.yml The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation: -#+BEGIN_SRC yaml :tangle yavdr07.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle yavdr07.yml :mkdirp yes :padline no --- # file: yavdr07.yml # this playbook sets up a complete yaVDR 0.7 installation @@ -204,15 +204,15 @@ ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***" #+END_SRC ** PPAs #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes - branch: unstable - ppa_owner: 'ppa:yavdr' - # a list of all package repositories to be added to the installation - repositories: - - '{{ ppa_owner }}/main' - - '{{ ppa_owner }}/unstable-main' - - '{{ ppa_owner }}/{{branch}}-vdr' - - '{{ ppa_owner }}/{{branch}}-yavdr' - - '{{ ppa_owner }}/{{branch}}-kodi' +branch: unstable +ppa_owner: 'ppa:yavdr' +# a list of all package repositories to be added to the installation +repositories: + - '{{ ppa_owner }}/main' + - '{{ ppa_owner }}/unstable-main' + - '{{ ppa_owner }}/{{branch}}-vdr' + - '{{ ppa_owner }}/{{branch}}-yavdr' + - '{{ ppa_owner }}/{{branch}}-kodi' #+END_SRC ** VDR user, directories, special configuration and plugins #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes @@ -644,6 +644,38 @@ install_avahi: true ** TODO yavdr-remote *** default variables *** tasks +#+BEGIN_SRC yaml :tangle roles/yavdr-remote/tasks/main.yml :mkdirp yes +--- +# This role is used to set up the yaVDR remote control configuration. + +- name: install yavdr-remote + apt: + name: yavdr-remote + state: present + +- name: install lirc + apt: + name: lircd + state: present + when: + - install_lircd is defined and install_lircd + +- name: install eventlircd + apt: + name: eventlircd + state: present + when: + install_eventlircd is defined and install_eventlircd + +# TODO: upload lircd2uinput package to PPA +#- name: install lircd2uinput +# tag: install +# apt: +# name: lircd2uinput +# state: present +# when: +# install_eventlircd is defined and install_eventlircd +#+END_SRC *** templates *** files @@ -1196,6 +1228,7 @@ b'\xde\xad\xbe\xef' state: started #+END_SRC *** templates +**** xorg #+BEGIN_SRC conf :tangle "roles/yavdr-xorg/templates/x-verbose@.service.j2" [Unit] Description=X with verbose logging on %I diff --git a/yavdr07-headless.yml b/yavdr07-headless.yml index f465b4d..9de97fc 100644 --- a/yavdr07-headless.yml +++ b/yavdr07-headless.yml @@ -1,4 +1,3 @@ - --- # file: yavdr07-headless.yml # this playbook set up a headless yaVDR 0.7 installation From 8a1aa945de4ea0f7bdfffa8518d4807b7d1ac998 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Tue, 20 Jun 2017 16:38:38 +0200 Subject: [PATCH 04/23] fix indentation errors --- Manual.org | 1779 ++++++++--------- library/hardware_facts.py | 194 +- .../autoinstall-ubuntu-drivers/tasks/main.yml | 27 +- roles/yavdr-xorg/templates/openbox_rc.xml.j2 | 1558 +++++++-------- 4 files changed, 1778 insertions(+), 1780 deletions(-) diff --git a/Manual.org b/Manual.org index 2c7817e..4ec25ab 100644 --- a/Manual.org +++ b/Manual.org @@ -1281,822 +1281,822 @@ systemctl --user isolate yavdr-desktop.target #+END_SRC ****** rc.xml #+BEGIN_SRC xml :tangle roles/yavdr-xorg/templates/openbox_rc.xml.j2 :mkdirp yes :padline no - - - - - 10 - 20 - - - yes - - no - - yes - - no - - 200 - - no - - - - Smart - -
yes
- - Active - - Active - -
- - Onyx - NLIMC - + + 10 + 20 + + + yes + + no + + yes + + no + + 200 + + no + + + + Smart + +
yes
+ + Active + + Active + +
+ + Onyx + NLIMC + + yes + yes + + sans + 8 + + bold + + normal + + + + sans + 8 + + bold + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + bold + + normal + + + + sans + 9 + + bold + + normal + + + + + + 2 + 1 + + - yes - yes - - sans - 8 - - bold - - normal - - - - sans - 8 - - bold - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - bold - - normal - - - - sans - 9 - - bold - - normal - - -
- - - 2 - 1 - - - - 875 - - - - yes - Nonpixel - - Center - - - - 10 - - 10 - - - - - - 0 - 0 - 0 - 0 - - - TopLeft - - 0 - 0 - no - Above - - Vertical - - no - 300 - - 300 - - Middle - - - - C-g - - - - left - no - - - - - right - no - - - - - up - no - - - - - down - no - - - - - left - no - - - - - right - no - - - - - up - no - - - - - down - no - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - - - - - - + + 875 + + + + yes + Nonpixel + + Center + + + + 10 + + 10 + + + + + + 0 + 0 + 0 + 0 + + + TopLeft + + 0 + 0 + no + Above + + Vertical + + no + 300 + + 300 + + Middle + + + + C-g + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + + + + + client-menu + + + + + + scrot -s + + + + + + + + + + + + + + + + + + + + + + + + yes + yes + + + + + + + + + + + right + + + + + left + + + + + up + + + + + down + + + + + + + true + Konqueror + + kfmclient openProfile filemanagement + + + + + + scrot + + + + + 1 + + 500 + + 400 + + false + + + + + + + + + + + + + + + + + + + + + - - + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + no + + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + client-menu - - - - - scrot -s + + + + + + top - - - - - - - - - + + + + + + left - - - - - - - - + + + + + + right - - - - yes - yes - - - - - + + + + + + bottom - - - - - right + + + + + + client-menu - - - - left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + client-menu - - - - up + + + + + + client-menu - - - - down + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vertical - - - - - - true - Konqueror - - kfmclient openProfile filemanagement + + + + horizontal - - - - - scrot + + + + + + + + + + + + + + + + previous - - - - 1 - - 500 - - 400 - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - - - - - - - - - no - - - - - - - - - - - yes - - - - - - - - - - - - - - - - - - - - - - - client-menu - - - - - - - top - - - - - - - left - - - - - - - right - - - - - - - bottom - - - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - client-menu - - - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vertical - - - - - horizontal - - - - - - - - - - - - - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - - - - - - - - - - - - client-list-combined-menu - - - - - root-menu - - - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - - - - - /var/lib/openbox/debian-menu.xml - menu.xml - 200 - - no - - 100 - - 400 - - yes - - yes - - - + + + client-list-combined-menu + + + + + root-menu + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + + no + + 100 + + 400 + + yes + + yes + + + + + + no true - # 'Horizontal', 'Vertical' or boolean (yes/no) + + yes - - # end of the example - --> - - - no - true - - yes - - - no - true - - yes - - - no - true - - yes - - -
+ + no + true + + yes + + + no + true + + yes + + + #+END_SRC ** samba-install @@ -2258,22 +2258,21 @@ from http://www.vdr-portal.de/board18-vdr-hardware/board102-dvb-karten/120817-tr The tool ubuntu-drivers is used to install the matching driver version for nvidia graphics cards, virtualbox guest additions and Intel and AMD microcode updates. *** tasks #+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml - --- - # file roles/autoinstall-ubuntu-drivers/tasks/main.yml +--- +# file roles/autoinstall-ubuntu-drivers/tasks/main.yml +- name: apt | install ubuntu-drivers-common + apt: + name: ubuntu-drivers-common + state: present - - name: apt | install ubuntu-drivers-common - apt: - name: ubuntu-drivers-common - state: present +- name: ensure /etc/yavdr exists + file: + path: /etc/yavdr + state: directory + mode: 0755 - - name: ensure /etc/yavdr exists - file: - path: /etc/yavdr - state: directory - mode: 0755 - - - name: let ubuntu-drivers automatically install additional drivers - command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall +- name: let ubuntu-drivers automatically install additional drivers + command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall #+END_SRC ** autoinstall-satip If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip is installed. @@ -2740,10 +2739,10 @@ fi This section contains custom modules for the yaVDR Playbooks. They are used to collect facts about the system and configure applications and daemons. ** hardware_facts.py #+BEGIN_SRC python :tangle library/hardware_facts.py - #!/usr/bin/env python +#!/usr/bin/env python - # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. - DOCUMENTATION = ''' +# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. +DOCUMENTATION = ''' --- module: hardware_facts short_description: collects facts for kernel modules, usb and pci devices @@ -2757,115 +2756,115 @@ This section contains custom modules for the yaVDR Playbooks. They are used to c description: - return a list of vendor- and device ids for usb devices in '04x:04x' notation - pci: - required: False - default: True - description: - - return a list of vendor- and device ids for pci devices in '04x:04x' notation + pci: + required: False + default: True + description: + - return a list of vendor- and device ids for pci devices in '04x:04x' notation - modules: - required: False - default: True - description: - - return a list of currently loaded kernel modules + modules: + required: False + default: True + description: + - return a list of currently loaded kernel modules - gpus: - required: False - default: True - description: - - return a list of devices of the pci gpu class (0x030000) - notes: - - requres python-pyusb and python-kmodpy - requirements: [ ] - author: "Alexander Grothe " - ''' + gpus: + required: False + default: True + description: + - return a list of devices of the pci gpu class (0x030000) +notes: + - requres python-pyusb and python-kmodpy +requirements: [ ] +author: "Alexander Grothe " +''' - EXAMPLES = ''' - - name: get information about usb and pci hardware and loaded kernel modules - hardware_facts: - usb: True - pci: True - modules: True - - debug: - var: usb - - debug - var: pci - - debug - var: modules - - debug - var: gpus - ''' +EXAMPLES = ''' +- name: get information about usb and pci hardware and loaded kernel modules + hardware_facts: + usb: True + pci: True + modules: True +- debug: + var: usb +- debug + var: pci +- debug + var: modules +- debug + var: gpus +''' - import glob - import json - import os - import sys - import usb.core - from collections import namedtuple +import glob +import json +import os +import sys +import usb.core +from collections import namedtuple - import kmodpy - from ansible.module_utils.basic import * +import kmodpy +from ansible.module_utils.basic import * - PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') +PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') - def get_pci_devices(): - for device in glob.glob('/sys/devices/pci*/*:*:*/'): - with open(os.path.join(device, 'device')) as d: - product_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'vendor')) as d: - vendor_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'class')) as d: - class_id = int(d.read().strip(), 16) - yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) +def get_pci_devices(): + for device in glob.glob('/sys/devices/pci*/*:*:*/'): + with open(os.path.join(device, 'device')) as d: + product_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'vendor')) as d: + vendor_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'class')) as d: + class_id = int(d.read().strip(), 16) + yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) - def format_device_list(iterator): - return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] +def format_device_list(iterator): + return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] - def format_gpu_device_list(iterator): - def get_entries(iterator): - for d in iterator: - if d.idClass == 0x030000: - yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) - return [entry for entry in get_entries(iterator)] +def format_gpu_device_list(iterator): + def get_entries(iterator): + for d in iterator: + if d.idClass == 0x030000: + yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) + return [entry for entry in get_entries(iterator)] - arg_specs = { - 'usb': dict(default=True, type='bool', required=False), - 'pci': dict(default=True, type='bool', required=False), - 'modules': dict(default=True, type='bool', required=False), - 'gpus': dict(default=True, type='bool', required=False), - } +arg_specs = { + 'usb': dict(default=True, type='bool', required=False), + 'pci': dict(default=True, type='bool', required=False), + 'modules': dict(default=True, type='bool', required=False), + 'gpus': dict(default=True, type='bool', required=False), + } - def main(): - module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) - collect_usb = module.params['usb'] - collect_pci = module.params['pci'] - collect_modules = module.params['modules'] - collect_gpus = module.params['gpus'] - if collect_usb: - usb_devices = format_device_list(usb.core.find(find_all=True)) - else: - usb_device = [] - if collect_pci: - pci_devices = format_device_list(get_pci_devices()) - else: - pci_devices = [] - if collect_modules: - k = kmodpy.Kmod() - modules = [m[0] for m in k.loaded()] - else: - modules = [] - if collect_gpus: - gpus = format_gpu_device_list(get_pci_devices()) - else: - gpus = [] - data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} - module.exit_json(changed=False, ansible_facts=data, msg=data) +def main(): + module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) + collect_usb = module.params['usb'] + collect_pci = module.params['pci'] + collect_modules = module.params['modules'] + collect_gpus = module.params['gpus'] + if collect_usb: + usb_devices = format_device_list(usb.core.find(find_all=True)) + else: + usb_device = [] + if collect_pci: + pci_devices = format_device_list(get_pci_devices()) + else: + pci_devices = [] + if collect_modules: + k = kmodpy.Kmod() + modules = [m[0] for m in k.loaded()] + else: + modules = [] + if collect_gpus: + gpus = format_gpu_device_list(get_pci_devices()) + else: + gpus = [] + data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} + module.exit_json(changed=False, ansible_facts=data, msg=data) - if __name__ == '__main__': - main() +if __name__ == '__main__': + main() #+END_SRC ** satip_facts.py #+BEGIN_SRC python :tangle library/satip_facts.py diff --git a/library/hardware_facts.py b/library/hardware_facts.py index ef58f76..d4b8bd2 100644 --- a/library/hardware_facts.py +++ b/library/hardware_facts.py @@ -1,7 +1,7 @@ - #!/usr/bin/env python +#!/usr/bin/env python - # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. - DOCUMENTATION = ''' +# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. +DOCUMENTATION = ''' --- module: hardware_facts short_description: collects facts for kernel modules, usb and pci devices @@ -15,112 +15,112 @@ description: - return a list of vendor- and device ids for usb devices in '04x:04x' notation - pci: - required: False - default: True - description: - - return a list of vendor- and device ids for pci devices in '04x:04x' notation + pci: + required: False + default: True + description: + - return a list of vendor- and device ids for pci devices in '04x:04x' notation - modules: - required: False - default: True - description: - - return a list of currently loaded kernel modules + modules: + required: False + default: True + description: + - return a list of currently loaded kernel modules - gpus: - required: False - default: True - description: - - return a list of devices of the pci gpu class (0x030000) - notes: - - requres python-pyusb and python-kmodpy - requirements: [ ] - author: "Alexander Grothe " - ''' + gpus: + required: False + default: True + description: + - return a list of devices of the pci gpu class (0x030000) +notes: + - requres python-pyusb and python-kmodpy +requirements: [ ] +author: "Alexander Grothe " +''' - EXAMPLES = ''' - - name: get information about usb and pci hardware and loaded kernel modules - hardware_facts: - usb: True - pci: True - modules: True - - debug: - var: usb - - debug - var: pci - - debug - var: modules - - debug - var: gpus - ''' +EXAMPLES = ''' +- name: get information about usb and pci hardware and loaded kernel modules + hardware_facts: + usb: True + pci: True + modules: True +- debug: + var: usb +- debug + var: pci +- debug + var: modules +- debug + var: gpus +''' - import glob - import json - import os - import sys - import usb.core - from collections import namedtuple +import glob +import json +import os +import sys +import usb.core +from collections import namedtuple - import kmodpy - from ansible.module_utils.basic import * +import kmodpy +from ansible.module_utils.basic import * - PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') +PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') - def get_pci_devices(): - for device in glob.glob('/sys/devices/pci*/*:*:*/'): - with open(os.path.join(device, 'device')) as d: - product_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'vendor')) as d: - vendor_id = int(d.read().strip(), 16) - with open(os.path.join(device, 'class')) as d: - class_id = int(d.read().strip(), 16) - yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) +def get_pci_devices(): + for device in glob.glob('/sys/devices/pci*/*:*:*/'): + with open(os.path.join(device, 'device')) as d: + product_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'vendor')) as d: + vendor_id = int(d.read().strip(), 16) + with open(os.path.join(device, 'class')) as d: + class_id = int(d.read().strip(), 16) + yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) - def format_device_list(iterator): - return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] +def format_device_list(iterator): + return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] - def format_gpu_device_list(iterator): - def get_entries(iterator): - for d in iterator: - if d.idClass == 0x030000: - yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) - return [entry for entry in get_entries(iterator)] +def format_gpu_device_list(iterator): + def get_entries(iterator): + for d in iterator: + if d.idClass == 0x030000: + yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) + return [entry for entry in get_entries(iterator)] - arg_specs = { - 'usb': dict(default=True, type='bool', required=False), - 'pci': dict(default=True, type='bool', required=False), - 'modules': dict(default=True, type='bool', required=False), - 'gpus': dict(default=True, type='bool', required=False), - } +arg_specs = { + 'usb': dict(default=True, type='bool', required=False), + 'pci': dict(default=True, type='bool', required=False), + 'modules': dict(default=True, type='bool', required=False), + 'gpus': dict(default=True, type='bool', required=False), + } - def main(): - module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) - collect_usb = module.params['usb'] - collect_pci = module.params['pci'] - collect_modules = module.params['modules'] - collect_gpus = module.params['gpus'] - if collect_usb: - usb_devices = format_device_list(usb.core.find(find_all=True)) - else: - usb_device = [] - if collect_pci: - pci_devices = format_device_list(get_pci_devices()) - else: - pci_devices = [] - if collect_modules: - k = kmodpy.Kmod() - modules = [m[0] for m in k.loaded()] - else: - modules = [] - if collect_gpus: - gpus = format_gpu_device_list(get_pci_devices()) - else: - gpus = [] - data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} - module.exit_json(changed=False, ansible_facts=data, msg=data) +def main(): + module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) + collect_usb = module.params['usb'] + collect_pci = module.params['pci'] + collect_modules = module.params['modules'] + collect_gpus = module.params['gpus'] + if collect_usb: + usb_devices = format_device_list(usb.core.find(find_all=True)) + else: + usb_device = [] + if collect_pci: + pci_devices = format_device_list(get_pci_devices()) + else: + pci_devices = [] + if collect_modules: + k = kmodpy.Kmod() + modules = [m[0] for m in k.loaded()] + else: + modules = [] + if collect_gpus: + gpus = format_gpu_device_list(get_pci_devices()) + else: + gpus = [] + data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus} + module.exit_json(changed=False, ansible_facts=data, msg=data) - if __name__ == '__main__': - main() +if __name__ == '__main__': + main() diff --git a/roles/autoinstall-ubuntu-drivers/tasks/main.yml b/roles/autoinstall-ubuntu-drivers/tasks/main.yml index ef82a2e..eefbcf5 100644 --- a/roles/autoinstall-ubuntu-drivers/tasks/main.yml +++ b/roles/autoinstall-ubuntu-drivers/tasks/main.yml @@ -1,16 +1,15 @@ - --- - # file roles/autoinstall-ubuntu-drivers/tasks/main.yml +--- +# file roles/autoinstall-ubuntu-drivers/tasks/main.yml +- name: apt | install ubuntu-drivers-common + apt: + name: ubuntu-drivers-common + state: present - - name: apt | install ubuntu-drivers-common - apt: - name: ubuntu-drivers-common - state: present +- name: ensure /etc/yavdr exists + file: + path: /etc/yavdr + state: directory + mode: 0755 - - name: ensure /etc/yavdr exists - file: - path: /etc/yavdr - state: directory - mode: 0755 - - - name: let ubuntu-drivers automatically install additional drivers - command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall +- name: let ubuntu-drivers automatically install additional drivers + command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall diff --git a/roles/yavdr-xorg/templates/openbox_rc.xml.j2 b/roles/yavdr-xorg/templates/openbox_rc.xml.j2 index e61c42a..d866a8c 100644 --- a/roles/yavdr-xorg/templates/openbox_rc.xml.j2 +++ b/roles/yavdr-xorg/templates/openbox_rc.xml.j2 @@ -1,816 +1,816 @@ - - - - - 10 - 20 - - - yes - - no - - yes - - no - - 200 - - no - - - - Smart - -
yes
- - Active - - Active - -
- - Onyx - NLIMC - + + 10 + 20 + + + yes + + no + + yes + + no + + 200 + + no + + + + Smart + +
yes
+ + Active + + Active + +
+ + Onyx + NLIMC + + yes + yes + + sans + 8 + + bold + + normal + + + + sans + 8 + + bold + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + bold + + normal + + + + sans + 9 + + bold + + normal + + + + + + 2 + 1 + + - yes - yes - - sans - 8 - - bold - - normal - - - - sans - 8 - - bold - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - bold - - normal - - - - sans - 9 - - bold - - normal - - -
- - - 2 - 1 - - - - 875 - - - - yes - Nonpixel - - Center - - - - 10 - - 10 - - - - - - 0 - 0 - 0 - 0 - - - TopLeft - - 0 - 0 - no - Above - - Vertical - - no - 300 - - 300 - - Middle - - - - C-g - - - - left - no - - - - - right - no - - - - - up - no - - - - - down - no - - - - - left - no - - - - - right - no - - - - - up - no - - - - - down - no - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - - - - - - + + 875 + + + + yes + Nonpixel + + Center + + + + 10 + + 10 + + + + + + 0 + 0 + 0 + 0 + + + TopLeft + + 0 + 0 + no + Above + + Vertical + + no + 300 + + 300 + + Middle + + + + C-g + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + + + + + client-menu + + + + + + scrot -s + + + + + + + + + + + + + + + + + + + + + + + + yes + yes + + + + + + + + + + + right + + + + + left + + + + + up + + + + + down + + + + + + + true + Konqueror + + kfmclient openProfile filemanagement + + + + + + scrot + + + + + 1 + + 500 + + 400 + + false + + + + + + + + + + + + + + + + + + + + + - - + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + no + + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + client-menu - - - - - scrot -s + + + + + + top - - - - - - - - - + + + + + + left - - - - - - - - + + + + + + right - - - - yes - yes - - - - - + + + + + + bottom - - - - - right + + + + + + client-menu - - - - left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + client-menu - - - - up + + + + + + client-menu - - - - down + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vertical - - - - - - true - Konqueror - - kfmclient openProfile filemanagement + + + + horizontal - - - - - scrot + + + + + + + + + + + + + + + + previous - - - - 1 - - 500 - - 400 - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - - - - - - - - - no - - - - - - - - - - - yes - - - - - - - - - - - - - - - - - - - - - - - client-menu - - - - - - - top - - - - - - - left - - - - - - - right - - - - - - - bottom - - - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - client-menu - - - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vertical - - - - - horizontal - - - - - - - - - - - - - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - - - - - - - - - - - - client-list-combined-menu - - - - - root-menu - - - - - - - previous - - - - - next - - - - - previous - - - - - next - - - - - - - - - /var/lib/openbox/debian-menu.xml - menu.xml - 200 - - no - - 100 - - 400 - - yes - - yes - - - + + + client-list-combined-menu + + + + + root-menu + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + + no + + 100 + + 400 + + yes + + yes + + + + + + no true - # 'Horizontal', 'Vertical' or boolean (yes/no) + + yes - - # end of the example - --> - - - no - true - - yes - - - no - true - - yes - - - no - true - - yes - - -
+ + no + true + + yes + + + no + true + + yes + + + From 2a039bcd3ad0216701849b4adb24c1d0ea43d637 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Tue, 20 Jun 2017 16:46:57 +0200 Subject: [PATCH 05/23] add role to install nvidia-381 driver --- roles/nvidia-381/tasks/main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 roles/nvidia-381/tasks/main.yml diff --git a/roles/nvidia-381/tasks/main.yml b/roles/nvidia-381/tasks/main.yml new file mode 100644 index 0000000..0cc1ceb --- /dev/null +++ b/roles/nvidia-381/tasks/main.yml @@ -0,0 +1,16 @@ +--- + +- name: add ppa:graphics-drivers/ppa + apt_repository: + repo: 'ppa:graphics-drivers/ppa' + state: present + update_cache: yes + +- name: install nvidia-381 and other required packages + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - nvidia-381 + - nvidia-settings From 2782daf93172f3ce355538ac786ea81de35b4c69 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Wed, 21 Jun 2017 10:14:35 +0200 Subject: [PATCH 06/23] update yavdr-xorg files --- roles/yavdr-xorg/templates/autostart.j2 | 9 - .../yavdr-xorg/templates/openbox/autostart.j2 | 25 + roles/yavdr-xorg/templates/openbox/rc.xml.j2 | 816 ++++++++++++++++++ .../system}/x-verbose@.service.j2 | 0 .../user/detect-second-display.service.j2 | 9 + .../systemd/user/openbox-second.service.j2 | 14 + .../templates/systemd/user/osd2web.service.j2 | 13 + .../templates/systemd/user/tmux.service.j2 | 12 + 8 files changed, 889 insertions(+), 9 deletions(-) delete mode 100644 roles/yavdr-xorg/templates/autostart.j2 create mode 100644 roles/yavdr-xorg/templates/openbox/autostart.j2 create mode 100644 roles/yavdr-xorg/templates/openbox/rc.xml.j2 rename roles/yavdr-xorg/templates/{ => systemd/system}/x-verbose@.service.j2 (100%) create mode 100644 roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 create mode 100644 roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 create mode 100644 roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 create mode 100644 roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 diff --git a/roles/yavdr-xorg/templates/autostart.j2 b/roles/yavdr-xorg/templates/autostart.j2 deleted file mode 100644 index 777c844..0000000 --- a/roles/yavdr-xorg/templates/autostart.j2 +++ /dev/null @@ -1,9 +0,0 @@ -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 - -if which dbus-update-activation-environment >/dev/null 2>&1; then - dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR -fi - -# start systemd units for the yavdr user session -systemctl --user isolate yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/openbox/autostart.j2 b/roles/yavdr-xorg/templates/openbox/autostart.j2 new file mode 100644 index 0000000..f3b16c7 --- /dev/null +++ b/roles/yavdr-xorg/templates/openbox/autostart.j2 @@ -0,0 +1,25 @@ +#!/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 + +enabled_services=("detect-second-display.service" "openbox-second.service" "osd2web.service") +disabled_services=() + +# enable configured services for the user session +for service in "${enabled_services[@]}"; do + systemctl --user enable "$service" +done + +# disable unwanted services for the user session +for service in "${disabled_services[@]}"; do + systemctl --user disable "$service" +done + +if which dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR +fi + +# start systemd units for the yavdr user session +systemctl --user isolate yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/openbox/rc.xml.j2 b/roles/yavdr-xorg/templates/openbox/rc.xml.j2 new file mode 100644 index 0000000..d866a8c --- /dev/null +++ b/roles/yavdr-xorg/templates/openbox/rc.xml.j2 @@ -0,0 +1,816 @@ + + + + + 10 + 20 + + + yes + + no + + yes + + no + + 200 + + no + + + + Smart + +
yes
+ + Active + + Active + +
+ + Onyx + NLIMC + + yes + yes + + sans + 8 + + bold + + normal + + + + sans + 8 + + bold + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + bold + + normal + + + + sans + 9 + + bold + + normal + + + + + + 2 + 1 + + + + 875 + + + + yes + Nonpixel + + Center + + + + 10 + + 10 + + + + + + 0 + 0 + 0 + 0 + + + TopLeft + + 0 + 0 + no + Above + + Vertical + + no + 300 + + 300 + + Middle + + + + C-g + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + + + + + client-menu + + + + + + scrot -s + + + + + + + + + + + + + + + + + + + + + + + + yes + yes + + + + + + + + + + + right + + + + + left + + + + + up + + + + + down + + + + + + + true + Konqueror + + kfmclient openProfile filemanagement + + + + + + scrot + + + + + 1 + + 500 + + 400 + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + no + + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + top + + + + + + + left + + + + + + + right + + + + + + + bottom + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vertical + + + + + horizontal + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + + + + client-list-combined-menu + + + + + root-menu + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + + no + + 100 + + 400 + + yes + + yes + + + + + + no + true + + yes + + + no + true + + yes + + + no + true + + yes + + +
diff --git a/roles/yavdr-xorg/templates/x-verbose@.service.j2 b/roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 similarity index 100% rename from roles/yavdr-xorg/templates/x-verbose@.service.j2 rename to roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 diff --git a/roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 b/roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 new file mode 100644 index 0000000..55f5fbe --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 @@ -0,0 +1,9 @@ +[Unit] +Description=Detect second DISPLAY using xrandr + +[Service] +Type=oneshot +ExecStart=/bin/bash -c 'export DISPLAY=$DISPLAY.1; xrandr -q | grep "connected" && echo "DISPLAY=$DISPLAY" > ~/.second_display || rm -f ~/.second_display' + +[Install] +WantedBy=yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 b/roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 new file mode 100644 index 0000000..5afe458 --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 @@ -0,0 +1,14 @@ +[Unit] +Description=Start openbox on the second DISPLAY if it exists +After=detect-second-display.service +Wants=detect-second-display.service +Before=yavdr-frontend.service +ConditionFileNotEmpty=%h/.second_display + +[Service] +PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +EnvironmentFile=%h/.second_display +ExecStart=/usr/bin/openbox --config-file %h/.config/openbox/rc.xml + +[Install] +WantedBy=yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 b/roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 new file mode 100644 index 0000000..2665393 --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=Start a kiosk browser on the second DISPLAY if it exists +After=detect-second-display.service openbox-second.service +Wants=detect-second-display.service openbox-second.service +ConditionFileNotEmpty=%h/.second_display + +[Service] +EnvironmentFile=%h/.second_display +PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +ExecStart=/usr/bin/on_vdr -o -c 'kiosk-browser "http://localhost:4444/skins/horchiTft/index.html?theme=blue&onlyView=1"' + +[Install] +WantedBy=yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 b/roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 new file mode 100644 index 0000000..b3066db --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=Start tmux in detached session + +[Service] +EnvironmentFile=-%h/.session-env +Type=forking +ExecStart=/usr/bin/tmux new-session -s use-session -d +ExecStop=/usr/bin/tmux kill-session -t %u +Restart=always + +[Install] +WantedBy=default.target From d45d4ff64367349c09c4fa46c7e8970bfe1c08bd Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Wed, 21 Jun 2017 12:46:51 +0200 Subject: [PATCH 07/23] fix padline option for source blocks --- Manual.org | 430 ++++++++++++++---- group_vars/all | 1 + handlers/main.yml | 1 + install-yavdr.sh | 1 + library/hardware_facts.py | 2 +- library/satip_facts.py | 0 library/xrandr_facts.py | 1 + roles/grub-config/handlers/main.yml | 2 + roles/grub-config/tasks/main.yml | 2 + roles/nfs-server/tasks/main.yml | 2 + roles/samba-config/tasks/main.yml | 1 + roles/samba-install/tasks/main.yml | 1 + roles/template-test/tasks/main.yml | 1 + roles/vdr/tasks/main.yml | 14 + roles/yavdr-common/defaults/main.yml | 1 + roles/yavdr-common/tasks/main.yml | 2 + roles/yavdr-network/tasks/main.yml | 21 + roles/yavdr-xorg/tasks/main.yml | 61 +-- .../yavdr-xorg/templates/openbox/autostart.j2 | 2 +- .../user}/yavdr-desktop.target.j2 | 0 20 files changed, 437 insertions(+), 109 deletions(-) mode change 100644 => 100755 library/hardware_facts.py mode change 100644 => 100755 library/satip_facts.py mode change 100644 => 100755 library/xrandr_facts.py mode change 100644 => 100755 roles/yavdr-xorg/templates/openbox/autostart.j2 rename roles/yavdr-xorg/templates/{ => systemd/user}/yavdr-desktop.target.j2 (100%) diff --git a/Manual.org b/Manual.org index 4ec25ab..9c58044 100644 --- a/Manual.org +++ b/Manual.org @@ -1,14 +1,19 @@ # -*- mode: org; -*- +# Local Variables: +# org-src-preserve-indentation: t +# End: :DOCUMENT_OPTIONS: #+HTML_HEAD: #+HTML_HEAD: - #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+OPTIONS: ^:nil -#+PROPERTY: header-args :mkdirp yes +# Local Variables: +# org-src-preserve-indentation: t +# End: +#+PROPERTY: header-args :mkdirp yes #+TITLE: Ansible Playbooks for yaVDR 0.7 #+Author: Alexander Grothe :END: @@ -166,7 +171,7 @@ The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation: #+END_SRC ** yavdr07-headless.yml For a headless server installation ~yavdr07-headless.yml~ is a good choice -#+BEGIN_SRC yaml :tangle yavdr07-headless.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle yavdr07-headless.yml :mkdirp yes :padline no --- # file: yavdr07-headless.yml # this playbook set up a headless yaVDR 0.7 installation @@ -189,14 +194,15 @@ For a headless server installation ~yavdr07-headless.yml~ is a good choice * Hosts This playbook can either be used to run the installation on the localhost or any other PC in the network that can be accessed via ssh. Simply add the host names or IP addresses to the hosts file in the respective section: -#+BEGIN_SRC conf :tangle localhost_inventory :mkdirp yes +#+BEGIN_SRC conf :tangle localhost_inventory :mkdirp yes :padline no [localhost] localhost connection=local #+END_SRC * Group Variables ** default text for templates used by ansible -#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes :padline no +--- # file: group_vars/all # this is the standard text to put in templates @@ -279,7 +285,7 @@ grub: ** install-dependencies *** tasks **** main.yml -#+BEGIN_SRC yaml :tangle roles/install-packages/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/install-packages/tasks/main.yml :mkdirp yes :padline no --- - name: apt | install packages @@ -295,7 +301,7 @@ grub: install nvidia-381 from ppa:graphics-drivers/ppa *** tasks **** main.yml -#+BEGIN_SRC yaml :tangle roles/nvidia-381/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/nvidia-381/tasks/main.yml :mkdirp yes :padline no --- - name: add ppa:graphics-drivers/ppa @@ -317,8 +323,9 @@ install nvidia-381 from ppa:graphics-drivers/ppa This role is used to set up a basic yaVDR installation. It creates the directories, installs the vdr and other useful packages. *** default variables This section is for reference only, please use the files in ~global_vars~ for customizations. -#+BEGIN_SRC yaml :tangle roles/yavdr-common/defaults/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/yavdr-common/defaults/main.yml :mkdirp yes :padline no --- + # file: roles/yavdr-common/defaults/main.yml #+END_SRC @@ -376,7 +383,9 @@ yavdr-common executes the following tasks: **** main.yml ***** Disable default installation of recommended packages This task prevents apt to automatically install all recommended dependencies for packages: - #+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes + #+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes :padline no +--- + - name: apt | prevent automatic installation of recommended packages template: src: templates/90-norecommends.j2 @@ -503,7 +512,7 @@ yavdr-common executes the following tasks: with_dict: '{{ media_dirs }}' #+END_SRC *** templates -#+BEGIN_SRC c :tangle roles/yavdr-common/templates/90-norecommends.j2 :mkdirp yes +#+BEGIN_SRC c :tangle roles/yavdr-common/templates/90-norecommends.j2 :mkdirp yes :padline no {{ ansible_managed_file | comment('c') }} // Recommends are as of now still abused in many packages APT::Install-Recommends "0"; @@ -512,7 +521,7 @@ APT::Install-Suggests "0"; ** vdr *** tasks **** install the basic vdr packages -#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes :padline no --- # file: roles/vdr/tasks/main.yml @@ -584,14 +593,163 @@ 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 +#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes +- 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' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + mode: 0644 +#+END_SRC + +*** templates +**** remote.conf +#+BEGIN_SRC conf :tangle roles/vdr/templates/remote.conf.j2 :mkdirp yes :padline no +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 +#+END_SRC ** STARTED yavdr-network *** default variables -#+BEGIN_SRC yaml :tangle roles/yavdr-network/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/yavdr-network/main.yml :mkdirp yes :padline no install_avahi: true #+END_SRC *** tasks -#+BEGIN_SRC yaml :tangle roles/yavdr-network/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/yavdr-network/tasks/main.yml :mkdirp yes :padline no --- # this playbook sets up network services for a yaVDR installation @@ -615,10 +773,32 @@ install_avahi: true # register: wol # with_items: '{% for interface in ansible_interfaces if interface != 'lo' and interface != 'bond0' %}' +- name: restart autofs + systemd: + name: autofs + state: restarted + enabled: yes + masked: no + +- name: ensure autofs is running + systemd: + name: autofs + state: started + enabled: yes + masked: no + +- name: start avahi-linker + systemd: + name: avahi-linker + state: started + enabled: yes + masked: no #+END_SRC ** nfs-server *** tasks -#+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes :padline no +--- + - name: install nfs server packages apt: name: '{{ item }}' @@ -635,7 +815,7 @@ install_avahi: true notify: [ 'Restart NFS Kernel Server' ] #+END_SRC *** templates -#+BEGIN_SRC conf :tangle roles/nfs-server/templates/nfs-exports.j2 :mkdirp yes +#+BEGIN_SRC conf :tangle roles/nfs-server/templates/nfs-exports.j2 :mkdirp yes :padline no /srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) {% for name, path in media_dirs.iteritems() %} {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) @@ -644,7 +824,7 @@ install_avahi: true ** TODO yavdr-remote *** default variables *** tasks -#+BEGIN_SRC yaml :tangle roles/yavdr-remote/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/yavdr-remote/tasks/main.yml :mkdirp yes :padline no --- # This role is used to set up the yaVDR remote control configuration. @@ -1063,11 +1243,10 @@ b'\xde\xad\xbe\xef' #+END_SRC *** default variables *** tasks -#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/main.yml :mkdirp yes :padline no --- # file: roles/yavdr-xorg/tasks/main.yml - # TODO: use hooks or requirements instead - name: Stop VDR systemd: @@ -1098,6 +1277,8 @@ b'\xde\xad\xbe\xef' - xlogin - xterm - openbox + - tmux + - kiosk-browser #- yavdr-xorg - name: "stop x@vt7.service" @@ -1107,7 +1288,7 @@ b'\xde\xad\xbe\xef' - name: "expand template for x-verbose@.service" template: - src: "templates/x-verbose@.service.j2" + src: "templates/systemd/system/x-verbose@.service.j2" dest: "/etc/systemd/system/x-verbose@.service" - name: "start x-verbose@.service" @@ -1145,36 +1326,30 @@ b'\xde\xad\xbe\xef' - '{{ vdr.home }}/.config/systemd/user' - '{{ vdr.home }}/.config/openbox/' -### TODO: move to yavdr-xorg package? ### - name: create folder for customizations of vdr.service file: state: directory dest: /etc/systemd/system/vdr.service.d mode: '0775' -- name: create folder for systemd user configuration - file: - state: directory - dest: '{{ vdr.home }}/.config/systemd/user' - mode: '0775' - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - -- name: create folder for openbox configuration - file: - state: directory - dest: '{{ vdr.home }}/.config/openbox' - mode: '0775' - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - - name: add dependency to X-server for vdr.service using a drop-in template: src: templates/vdr-xorg.conf dest: /etc/systemd/system/vdr.service.d/ -### END TODO ### -- name: create .xinitrc for vdr user +- name: create folders for user configuration files + file: + state: directory + dest: '{{ item }}' + mode: '0775' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + with_items: + - '{{ vdr.home }}/.config/systemd/user' + - '{{ vdr.home }}/.config/openbox' + - '{{ vdr.home }}/.config/pulse' + +- name: expand template for .xinitrc for vdr user template: src: 'templates/.xinitrc.j2' dest: '{{ vdr.home }}/.xinitrc' @@ -1182,9 +1357,9 @@ b'\xde\xad\xbe\xef' owner: '{{ vdr.user }}' group: '{{ vdr.group }}' -- name: populate autostart for openbox +- name: expand template for openbox autostart template: - src: 'templates/autostart.j2' + src: 'templates/openbox/autostart.j2' dest: '{{ vdr.home }}/.config/openbox/autostart' mode: 0755 owner: '{{ vdr.user }}' @@ -1192,20 +1367,29 @@ b'\xde\xad\xbe\xef' - name: expand rc.xml for openbox template: - src: 'templates/openbox_rc.xml.j2' + src: 'templates/openbox/rc.xml.j2' dest: '{{ vdr.home }}/.config/openbox/rc.xml' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' -- name: create yavdr.target for the user session +- name: create yavdr-desktop.target for the user session template: - src: 'templates/yavdr-desktop.target.j2' + src: 'templates/systemd/user/yavdr-desktop.target.j2' dest: '{{ vdr.home }}/.config/systemd/user/yavdr-desktop.target' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' +- name: disable pulseaudio autospawning + lineinfile: + path: '{{ vdr.home }}/.config/pulse/client.conf' + line: 'autospawn = no' + create: yes + state: present + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + - name: set a login shell for the user vdr user: name: '{{ vdr.user }}' @@ -1215,6 +1399,11 @@ b'\xde\xad\xbe\xef' groups: '{{ vdr.group }}' append: yes +- name: create tmux.service for the session + template: + src: roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 + dest: '{{ vdr.home }}/.config/systemd/user/tmux.service' + # TODO: run xorg-debug and parse xrandr output # TODO: expand template for xorg.conf (or snippets) # with respect for the available graphics card driver @@ -1229,7 +1418,8 @@ b'\xde\xad\xbe\xef' #+END_SRC *** templates **** xorg -#+BEGIN_SRC conf :tangle "roles/yavdr-xorg/templates/x-verbose@.service.j2" +***** x-verbose@.service +#+BEGIN_SRC conf :tangle "roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2" :padline no [Unit] Description=X with verbose logging on %I Wants=graphical.target @@ -1239,8 +1429,8 @@ Before=graphical.target Type=forking ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I #+END_SRC - -#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/vdr-xorg.conf :mkdirp yes +***** Drop-in snippet for vdr.service +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/vdr-xorg.conf :mkdirp yes :padline no # file: roles/yavdr-xorg/templates/vdr-xorg.conf # {{ ansible_managed_file }} @@ -1249,13 +1439,14 @@ After=x@vt7.service Wants=x@vt7.service #BindsTo=x@vt7.service #+END_SRC -#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/.xinitrc.j2 :mkdirp yes +#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/.xinitrc.j2 :mkdirp yes :padline no #!/bin/bash # {{ ansible_managed_file }} exec openbox-session #+END_SRC - -#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/yavdr-desktop.target.j2 :mkdirp yes +**** Systemd User Session +***** yavdr-desktop.target +#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/systemd/user/yavdr-desktop.target.j2 :mkdirp yes :padline no [Unit] Description=yaVDR Desktop Requires=default.target @@ -1265,13 +1456,87 @@ 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] +Description=Detect second DISPLAY using xrandr + +[Service] +Type=oneshot +ExecStart=/bin/bash -c 'export DISPLAY=$DISPLAY.1; xrandr -q | grep "connected" && echo "DISPLAY=$DISPLAY" > ~/.second_display || rm -f ~/.second_display' + +[Install] +WantedBy=yavdr-desktop.target +#+END_SRC +***** openbox-second.service +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 :mkdirp yes :padline no +[Unit] +Description=Start openbox on the second DISPLAY if it exists +After=detect-second-display.service +Wants=detect-second-display.service +Before=yavdr-frontend.service +ConditionFileNotEmpty=%h/.second_display + +[Service] +PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +EnvironmentFile=%h/.second_display +ExecStart=/usr/bin/openbox --config-file %h/.config/openbox/rc.xml + +[Install] +WantedBy=yavdr-desktop.target +#+END_SRC +***** osd2web.service +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 :mkdirp yes :padline no +[Unit] +Description=Start a kiosk browser on the second DISPLAY if it exists +After=detect-second-display.service openbox-second.service +Wants=detect-second-display.service openbox-second.service +ConditionFileNotEmpty=%h/.second_display + +[Service] +EnvironmentFile=%h/.second_display +PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +ExecStart=/usr/bin/on_vdr -o -c 'kiosk-browser "http://localhost:4444/skins/horchiTft/index.html?theme=blue&onlyView=1"' + +[Install] +WantedBy=yavdr-desktop.target +#+END_SRC +***** tmux.service +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 :mkdirp yes :padline no +[Unit] +Description=Start tmux in detached session + +[Service] +EnvironmentFile=-%h/.session-env +Type=forking +ExecStart=/usr/bin/tmux new-session -s use-session -d +ExecStop=/usr/bin/tmux kill-session -t %u +Restart=always + +[Install] +WantedBy=default.target #+END_SRC **** openbox -****** autostart -#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/autostart.j2 :mkdirp yes +***** autostart +#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/openbox/autostart.j2 :mkdirp yes :shebang #!/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 +enabled_services=("tmux.service" "detect-second-display.service" "openbox-second.service" "osd2web.service") +disabled_services=() + +# enable configured services for the user session +for service in "${enabled_services[@]}"; do + systemctl --user enable "$service" +done + +# disable unwanted services for the user session +for service in "${disabled_services[@]}"; do + systemctl --user disable "$service" +done + if which dbus-update-activation-environment >/dev/null 2>&1; then dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR fi @@ -1279,8 +1544,8 @@ fi # start systemd units for the yavdr user session systemctl --user isolate yavdr-desktop.target #+END_SRC -****** rc.xml -#+BEGIN_SRC xml :tangle roles/yavdr-xorg/templates/openbox_rc.xml.j2 :mkdirp yes :padline no +***** rc.xml +#+BEGIN_SRC xml :tangle roles/yavdr-xorg/templates/openbox/rc.xml.j2 :mkdirp yes :padline no - yes + no no @@ -2099,9 +2364,11 @@ systemctl --user isolate yavdr-desktop.target #+END_SRC + ** samba-install *** tasks -#+BEGIN_SRC yaml :tangle roles/samba-install/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/samba-install/tasks/main.yml :mkdirp yes :padline no +--- # file: roles/samba-install/tasks/main.yml - name: install samba server @@ -2118,7 +2385,8 @@ systemctl --user isolate yavdr-desktop.target #+END_SRC ** samba-config *** tasks -#+BEGIN_SRC yaml :tangle roles/samba-config/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/samba-config/tasks/main.yml :mkdirp yes :padline no +--- # file: roles/samba-config/tasks/main.yml # TODO: @@ -2140,7 +2408,7 @@ systemctl --user isolate yavdr-desktop.target *** templates **** smb.conf ***** global settings -#+BEGIN_SRC yaml :tangle roles/samba-config/templates/smb.conf.j2 :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/samba-config/templates/smb.conf.j2 :mkdirp yes :padline no {{ ansible_managed_file | comment }} #======================= Global Settings ======================= @@ -2257,7 +2525,7 @@ from http://www.vdr-portal.de/board18-vdr-hardware/board102-dvb-karten/120817-tr ** autoinstall-ubuntu-drivers The tool ubuntu-drivers is used to install the matching driver version for nvidia graphics cards, virtualbox guest additions and Intel and AMD microcode updates. *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml :padline no --- # file roles/autoinstall-ubuntu-drivers/tasks/main.yml - name: apt | install ubuntu-drivers-common @@ -2277,7 +2545,7 @@ The tool ubuntu-drivers is used to install the matching driver version for nvidi ** autoinstall-satip If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip is installed. *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-satip/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-satip/tasks/main.yml :padline no --- # file roles/autoinstall-satip/tasks/main.yml @@ -2297,7 +2565,7 @@ If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip ** autoinstall-targavfd *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-targavfd/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-targavfd/tasks/main.yml :padline no --- # file roles/autoinstall-targavfd/tasks/main.yml @@ -2310,7 +2578,7 @@ If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip #+END_SRC ** autoinstall-imonlcd *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-imonlcd/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-imonlcd/tasks/main.yml :padline no --- # file roles/autoinstall-imonlcd/tasks/main.yml @@ -2324,7 +2592,7 @@ If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip #+END_SRC ** autoinstall-libcecdaemon *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-libcecdaemon/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-libcecdaemon/tasks/main.yml :padline no --- # file roles/autoinstall-libcec-daemon/tasks/main.yml @@ -2336,7 +2604,7 @@ If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip #+END_SRC ** autoinstall-pvr350 *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-pvr350/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-pvr350/tasks/main.yml :padline no --- # file roles/autoinstall-pvr350/tasks/main.yml @@ -2351,7 +2619,7 @@ If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip ** TODO autoinstall-dvbhddevice Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware sollte in yavdr-firmware stecken *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbhddevice/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbhddevice/tasks/main.yml :padline no --- # file roles/autoinstall-dvbhddevice/tasks/main.yml @@ -2366,7 +2634,7 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll ** autoinstall-dvbsddevice *** tasks -#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbsddevice/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbsddevice/tasks/main.yml :padline no --- # file roles/autoinstall-dvbsddevice/tasks/main.yml @@ -2380,7 +2648,7 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll ** dvd *** tasks **** install libdvd-pkg -#+BEGIN_SRC yaml :tangle roles/dvd/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/dvd/tasks/main.yml :mkdirp yes :padline no --- # file: roles/dvd/tasks/main.yml @@ -2401,7 +2669,7 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll ** kodi *** tasks **** Install KODI -#+BEGIN_SRC yaml :tangle roles/kodi/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/kodi/tasks/main.yml :mkdirp yes :padline no --- - name: change udev rule to allow KODI to eject optical disks @@ -2430,7 +2698,7 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll #+END_SRC *** templates **** kodi.service -#+BEGIN_SRC conf :tangle roles/kodi/templates/kodi.service.j2 :mkdirp yes +#+BEGIN_SRC conf :tangle roles/kodi/templates/kodi.service.j2 :mkdirp yes :padline no [Unit] Description=Start kodi in user session @@ -2445,8 +2713,9 @@ SuccessExitStatus=0 127 Restart=on-failure #+END_SRC ** template-test -#+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml +#+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml :padline no --- + - name: show vars debug: var: '{{ system }}' @@ -2680,7 +2949,7 @@ system: #+END_SRC ** grub-config *** default variables -#+BEGIN_SRC yaml :tangle roles/grub-config/defaults/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/grub-config/defaults/main.yml :mkdirp yes :padline no system: shutdown: poweroff grub: @@ -2688,7 +2957,9 @@ grub: boot_options: quiet nosplash #+END_SRC *** tasks -#+BEGIN_SRC yaml :tangle roles/grub-config/tasks/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/grub-config/tasks/main.yml :mkdirp yes :padline no +--- + - name: custom grub configuration for timeout and reboot halt template: src: templates/50_custom.j2 @@ -2707,7 +2978,7 @@ grub: notify: [ 'Update GRUB' ] #+END_SRC *** templates -#+BEGIN_SRC shell :tangle roles/grub-config/templates/50_custom.j2 :mkdirp yes +#+BEGIN_SRC shell :tangle roles/grub-config/templates/50_custom.j2 :mkdirp yes :padline no #!/bin/sh exec tail -n +3 $0 @@ -2726,7 +2997,9 @@ else fi #+END_SRC *** handlers -#+BEGIN_SRC yaml :tangle roles/grub-config/handlers/main.yml :mkdirp yes +#+BEGIN_SRC yaml :tangle roles/grub-config/handlers/main.yml :mkdirp yes :padline no +--- + - name: Update GRUB command: update-grub failed_when: ('error' in grub_register_update.stderr) @@ -2738,9 +3011,7 @@ fi * Modules This section contains custom modules for the yaVDR Playbooks. They are used to collect facts about the system and configure applications and daemons. ** hardware_facts.py -#+BEGIN_SRC python :tangle library/hardware_facts.py -#!/usr/bin/env python - +#+BEGIN_SRC python :tangle library/hardware_facts.py :shebang #!/usr/bin/env/python # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. DOCUMENTATION = ''' --- @@ -2867,9 +3138,7 @@ if __name__ == '__main__': main() #+END_SRC ** satip_facts.py -#+BEGIN_SRC python :tangle library/satip_facts.py -#!/usr/bin/env python2 - +#+BEGIN_SRC python :tangle library/satip_facts.py :shebang #!/usr/bin/env python2 DOCUMENTATION = ''' --- module: hardware_facts @@ -2935,8 +3204,7 @@ if __name__ == '__main__': ** xrandr_facts.py - [ ] support multiple screens (-d :0.0 .. :0.n) -#+BEGIN_SRC python :tangle library/xrandr_facts.py -#!/usr/bin/env python2 +#+BEGIN_SRC python :tangle library/xrandr_facts.py :shebang #!/usr/bin/env python2 from __future__ import print_function import ast import binascii diff --git a/group_vars/all b/group_vars/all index dd92388..3a23e6e 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1,3 +1,4 @@ +--- # file: group_vars/all # this is the standard text to put in templates diff --git a/handlers/main.yml b/handlers/main.yml index 840b674..d7fd733 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,3 +1,4 @@ + - name: Restart Samba systemd: name: smbd.service diff --git a/install-yavdr.sh b/install-yavdr.sh index d3bd2d8..d8aa931 100755 --- a/install-yavdr.sh +++ b/install-yavdr.sh @@ -1,4 +1,5 @@ #!/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 old mode 100644 new mode 100755 index d4b8bd2..c02736a --- a/library/hardware_facts.py +++ b/library/hardware_facts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/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 old mode 100644 new mode 100755 diff --git a/library/xrandr_facts.py b/library/xrandr_facts.py old mode 100644 new mode 100755 index f9cf680..2b45c66 --- a/library/xrandr_facts.py +++ b/library/xrandr_facts.py @@ -1,4 +1,5 @@ #!/usr/bin/env python2 + from __future__ import print_function import ast import binascii diff --git a/roles/grub-config/handlers/main.yml b/roles/grub-config/handlers/main.yml index a7e3e2c..b6d741c 100644 --- a/roles/grub-config/handlers/main.yml +++ b/roles/grub-config/handlers/main.yml @@ -1,3 +1,5 @@ +--- + - name: Update GRUB command: update-grub failed_when: ('error' in grub_register_update.stderr) diff --git a/roles/grub-config/tasks/main.yml b/roles/grub-config/tasks/main.yml index 6a24bad..c7c40f3 100644 --- a/roles/grub-config/tasks/main.yml +++ b/roles/grub-config/tasks/main.yml @@ -1,3 +1,5 @@ +--- + - name: custom grub configuration for timeout and reboot halt template: src: templates/50_custom.j2 diff --git a/roles/nfs-server/tasks/main.yml b/roles/nfs-server/tasks/main.yml index cc0be13..fff57cf 100644 --- a/roles/nfs-server/tasks/main.yml +++ b/roles/nfs-server/tasks/main.yml @@ -1,3 +1,5 @@ +--- + - name: install nfs server packages apt: name: '{{ item }}' diff --git a/roles/samba-config/tasks/main.yml b/roles/samba-config/tasks/main.yml index b1cfcb0..cd38366 100644 --- a/roles/samba-config/tasks/main.yml +++ b/roles/samba-config/tasks/main.yml @@ -1,3 +1,4 @@ +--- # file: roles/samba-config/tasks/main.yml # TODO: diff --git a/roles/samba-install/tasks/main.yml b/roles/samba-install/tasks/main.yml index 2c6358a..21ea28b 100644 --- a/roles/samba-install/tasks/main.yml +++ b/roles/samba-install/tasks/main.yml @@ -1,3 +1,4 @@ +--- # file: roles/samba-install/tasks/main.yml - name: install samba server diff --git a/roles/template-test/tasks/main.yml b/roles/template-test/tasks/main.yml index a2a30b2..b9ed95a 100644 --- a/roles/template-test/tasks/main.yml +++ b/roles/template-test/tasks/main.yml @@ -1,4 +1,5 @@ --- + - name: show vars debug: var: '{{ system }}' diff --git a/roles/vdr/tasks/main.yml b/roles/vdr/tasks/main.yml index e4b3c69..327cdeb 100644 --- a/roles/vdr/tasks/main.yml +++ b/roles/vdr/tasks/main.yml @@ -61,3 +61,17 @@ 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' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + mode: 0644 diff --git a/roles/yavdr-common/defaults/main.yml b/roles/yavdr-common/defaults/main.yml index 1f53b94..17c5dac 100644 --- a/roles/yavdr-common/defaults/main.yml +++ b/roles/yavdr-common/defaults/main.yml @@ -1,4 +1,5 @@ --- + # file: roles/yavdr-common/defaults/main.yml branch: unstable diff --git a/roles/yavdr-common/tasks/main.yml b/roles/yavdr-common/tasks/main.yml index 24d4dab..96268d5 100644 --- a/roles/yavdr-common/tasks/main.yml +++ b/roles/yavdr-common/tasks/main.yml @@ -1,3 +1,5 @@ +--- + - name: apt | prevent automatic installation of recommended packages template: src: templates/90-norecommends.j2 diff --git a/roles/yavdr-network/tasks/main.yml b/roles/yavdr-network/tasks/main.yml index 7efe237..6f9e8e7 100644 --- a/roles/yavdr-network/tasks/main.yml +++ b/roles/yavdr-network/tasks/main.yml @@ -20,3 +20,24 @@ # shell: 'ethtool {{ item }} | grep -Po "(?<=Supports\sWake-on:\s).*$"' # register: wol # with_items: '{% for interface in ansible_interfaces if interface != 'lo' and interface != 'bond0' %}' + +- name: restart autofs + systemd: + name: autofs + state: restarted + enabled: yes + masked: no + +- name: ensure autofs is running + systemd: + name: autofs + state: started + enabled: yes + masked: no + +- name: start avahi-linker + systemd: + name: avahi-linker + state: started + enabled: yes + masked: no diff --git a/roles/yavdr-xorg/tasks/main.yml b/roles/yavdr-xorg/tasks/main.yml index ceb5782..9e30d58 100644 --- a/roles/yavdr-xorg/tasks/main.yml +++ b/roles/yavdr-xorg/tasks/main.yml @@ -1,7 +1,6 @@ --- # file: roles/yavdr-xorg/tasks/main.yml - # TODO: use hooks or requirements instead - name: Stop VDR systemd: @@ -32,6 +31,8 @@ - xlogin - xterm - openbox + - tmux + - kiosk-browser #- yavdr-xorg - name: "stop x@vt7.service" @@ -41,7 +42,7 @@ - name: "expand template for x-verbose@.service" template: - src: "templates/x-verbose@.service.j2" + src: "templates/systemd/system/x-verbose@.service.j2" dest: "/etc/systemd/system/x-verbose@.service" - name: "start x-verbose@.service" @@ -79,36 +80,30 @@ - '{{ vdr.home }}/.config/systemd/user' - '{{ vdr.home }}/.config/openbox/' -### TODO: move to yavdr-xorg package? ### - name: create folder for customizations of vdr.service file: state: directory dest: /etc/systemd/system/vdr.service.d mode: '0775' -- name: create folder for systemd user configuration - file: - state: directory - dest: '{{ vdr.home }}/.config/systemd/user' - mode: '0775' - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - -- name: create folder for openbox configuration - file: - state: directory - dest: '{{ vdr.home }}/.config/openbox' - mode: '0775' - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - - name: add dependency to X-server for vdr.service using a drop-in template: src: templates/vdr-xorg.conf dest: /etc/systemd/system/vdr.service.d/ -### END TODO ### -- name: create .xinitrc for vdr user +- name: create folders for user configuration files + file: + state: directory + dest: '{{ item }}' + mode: '0775' + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + with_items: + - '{{ vdr.home }}/.config/systemd/user' + - '{{ vdr.home }}/.config/openbox' + - '{{ vdr.home }}/.config/pulse' + +- name: expand template for .xinitrc for vdr user template: src: 'templates/.xinitrc.j2' dest: '{{ vdr.home }}/.xinitrc' @@ -116,9 +111,9 @@ owner: '{{ vdr.user }}' group: '{{ vdr.group }}' -- name: populate autostart for openbox +- name: expand template for openbox autostart template: - src: 'templates/autostart.j2' + src: 'templates/openbox/autostart.j2' dest: '{{ vdr.home }}/.config/openbox/autostart' mode: 0755 owner: '{{ vdr.user }}' @@ -126,20 +121,29 @@ - name: expand rc.xml for openbox template: - src: 'templates/openbox_rc.xml.j2' + src: 'templates/openbox/rc.xml.j2' dest: '{{ vdr.home }}/.config/openbox/rc.xml' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' -- name: create yavdr.target for the user session +- name: create yavdr-desktop.target for the user session template: - src: 'templates/yavdr-desktop.target.j2' + src: 'templates/systemd/user/yavdr-desktop.target.j2' dest: '{{ vdr.home }}/.config/systemd/user/yavdr-desktop.target' mode: 0755 owner: '{{ vdr.user }}' group: '{{ vdr.group }}' +- name: disable pulseaudio autospawning + lineinfile: + path: '{{ vdr.home }}/.config/pulse/client.conf' + line: 'autospawn = no' + create: yes + state: present + owner: '{{ vdr.user }}' + group: '{{ vdr.group }}' + - name: set a login shell for the user vdr user: name: '{{ vdr.user }}' @@ -149,6 +153,11 @@ groups: '{{ vdr.group }}' append: yes +- name: create tmux.service for the session + template: + src: roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 + dest: '{{ vdr.home }}/.config/systemd/user/tmux.service' + # TODO: run xorg-debug and parse xrandr output # TODO: expand template for xorg.conf (or snippets) # with respect for the available graphics card driver diff --git a/roles/yavdr-xorg/templates/openbox/autostart.j2 b/roles/yavdr-xorg/templates/openbox/autostart.j2 old mode 100644 new mode 100755 index f3b16c7..160c8e3 --- a/roles/yavdr-xorg/templates/openbox/autostart.j2 +++ b/roles/yavdr-xorg/templates/openbox/autostart.j2 @@ -4,7 +4,7 @@ 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 -enabled_services=("detect-second-display.service" "openbox-second.service" "osd2web.service") +enabled_services=("tmux.service" "detect-second-display.service" "openbox-second.service" "osd2web.service") disabled_services=() # enable configured services for the user session diff --git a/roles/yavdr-xorg/templates/yavdr-desktop.target.j2 b/roles/yavdr-xorg/templates/systemd/user/yavdr-desktop.target.j2 similarity index 100% rename from roles/yavdr-xorg/templates/yavdr-desktop.target.j2 rename to roles/yavdr-xorg/templates/systemd/user/yavdr-desktop.target.j2 From d7000f0dac0d1d593dadc7b420adc49d61c613b3 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 22 Jun 2017 12:09:49 +0200 Subject: [PATCH 08/23] Fix indentation for /etc/exports template --- Manual.org | 25 +++++++++++++++++++---- roles/nfs-server/templates/nfs-exports.j2 | 8 ++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Manual.org b/Manual.org index 9c58044..60e188a 100644 --- a/Manual.org +++ b/Manual.org @@ -813,13 +813,30 @@ install_avahi: true src: templates/nfs-exports.j2 dest: /etc/exports notify: [ 'Restart NFS Kernel Server' ] + +- name populate /etc/avahi/services #+END_SRC *** templates +**** /etc/exports #+BEGIN_SRC conf :tangle roles/nfs-server/templates/nfs-exports.j2 :mkdirp yes :padline no - /srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) - {% for name, path in media_dirs.iteritems() %} - {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) - {% endfor %} +/srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) +{% for name, path in media_dirs.iteritems() %} +{{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) +{% endfor %} +#+END_SRC +**** avahi services +#+BEGIN_SRC xml :tangle roles/yavdr-network/avahi/service.j2 :mkdirp yes :padline no + + + +{{ item|capitalize }} on %h ## Name + + _nfs._tcp + 2049 + path={{ item.path }} ## path to shared Folder + subtype={% 'vdr' if item == 'recordings' else item %} ## subtype + + #+END_SRC ** TODO yavdr-remote *** default variables diff --git a/roles/nfs-server/templates/nfs-exports.j2 b/roles/nfs-server/templates/nfs-exports.j2 index 81e8a95..eabb162 100644 --- a/roles/nfs-server/templates/nfs-exports.j2 +++ b/roles/nfs-server/templates/nfs-exports.j2 @@ -1,4 +1,4 @@ - /srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) - {% for name, path in media_dirs.iteritems() %} - {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) - {% endfor %} +/srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) +{% for name, path in media_dirs.iteritems() %} +{{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) +{% endfor %} From 2cef31ad85123d49bb0d17be517522ae035c184c Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 22 Jun 2017 12:10:23 +0200 Subject: [PATCH 09/23] add pulseaudio role --- Manual.org | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Manual.org b/Manual.org index 60e188a..fbaf158 100644 --- a/Manual.org +++ b/Manual.org @@ -30,6 +30,7 @@ Several roles are used to tie everything together: - yavdr-common :: installs the basic set of packages needed and preconfigures the system (package sources, package manager settings, entires for network ports, directory structure etc.). Also collects information about the system - autoinstall-ubuntu-drivers :: uses Ubuntu's automatic detection for additional drivers (e.g. proprietary nvidia driver, microcode updates, VirtualBox guest additions) - vdr :: install the vdr package and required plugins +- pulseaudio :: install and preconfigure pulseaudio - yavdr-network :: configure WOL, add nfs client capabilites, install avahi-linker - samba-server :: install and preconfigure a samba server - nfs-server :: install nfs-kernelserver and preconfigure nfs exports (and avahi-announcements) @@ -155,6 +156,7 @@ The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation: - samba-install # install samba server - samba-config # configure samba server - nfs-server # install nfs server + - pulseaudio # install pulseaudio - yavdr-xorg # graphical session - yavdr-remote # remote configuration files, services and scripts - autoinstall-satip # install vdr-plugin-satip if a Sat>IP server has been found @@ -876,6 +878,41 @@ install_avahi: true *** templates *** files +** pulseaudio +*** tasks +#+BEGIN_SRC yaml :tangle roles/pulseaudio/tasks/main.yml :mkdirp yes :padline no +--- + +- name: install pulseaudio + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - pulseaudio + - pavucontrol + +- name: create /etc/asound.conf + template: + src: templates/alsa/asound.conf.j2 + dest: /etc/asound.conf +#+END_SRC +*** templates +#+BEGIN_SRC conf :tangle roles/pulseaudio/templates/alsa/asound.conf.j2 :mkdirp yes :padline no +# Use PulseAudio by default +pcm.!default { + type pulse + fallback "sysdefault" + hint { + show on + description "Default ALSA Output (currently PulseAudio Sound Server)" + } +} + +ctl.!default { + type pulse + fallback "sysdefault" +} +#+END_SRC ** yavdr-xorg *** TODO automatic X-server configuration - [X] detect connected display From 1ca87262df922f94bf32077de761bf326f8b114b Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 22 Jun 2017 12:10:56 +0200 Subject: [PATCH 10/23] add pulseaudio role to yavdr07.yml playbook --- yavdr07.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/yavdr07.yml b/yavdr07.yml index b4ef79e..39f19ce 100644 --- a/yavdr07.yml +++ b/yavdr07.yml @@ -13,6 +13,7 @@ - samba-install # install samba server - samba-config # configure samba server - nfs-server # install nfs server + - pulseaudio # install pulseaudio - yavdr-xorg # graphical session - yavdr-remote # remote configuration files, services and scripts - autoinstall-satip # install vdr-plugin-satip if a Sat>IP server has been found From ae8d54aed133018e585e76f0448c0a1680a4fd37 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 22 Jun 2017 13:28:10 +0200 Subject: [PATCH 11/23] vdr.service: load environment from user session, create avahi services --- Manual.org | 31 ++++++++++++++++++++++++++----- roles/nfs-server/tasks/main.yml | 7 +++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Manual.org b/Manual.org index fbaf158..f6a1a96 100644 --- a/Manual.org +++ b/Manual.org @@ -796,6 +796,7 @@ install_avahi: true enabled: yes masked: no #+END_SRC + ** nfs-server *** tasks #+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes :padline no @@ -816,7 +817,11 @@ install_avahi: true dest: /etc/exports notify: [ 'Restart NFS Kernel Server' ] -- name populate /etc/avahi/services +- name: populate /etc/avahi/services + template: + src: templates/avahi/service.j2 + dest: '/etc/avahi/services/yavdr-{{ item.key }}.service' + with_dict: '{{ media_dirs }}' #+END_SRC *** templates **** /etc/exports @@ -827,16 +832,16 @@ install_avahi: true {% endfor %} #+END_SRC **** avahi services -#+BEGIN_SRC xml :tangle roles/yavdr-network/avahi/service.j2 :mkdirp yes :padline no +#+BEGIN_SRC xml :tangle roles/nfs-server/templates/avahi/service.j2 :mkdirp yes :padline no -{{ item|capitalize }} on %h ## Name +{{ item.key|capitalize }} on %h ## Name _nfs._tcp 2049 - path={{ item.path }} ## path to shared Folder - subtype={% 'vdr' if item == 'recordings' else item %} ## subtype + path={{ item.value }} ## path to shared Folder + subtype={{ 'vdr' if item.key == 'recordings' else item.key }} ## subtype #+END_SRC @@ -884,6 +889,7 @@ install_avahi: true --- - name: install pulseaudio + apt: name: '{{ item }}' state: present install_recommends: no @@ -1309,6 +1315,16 @@ b'\xde\xad\xbe\xef' enabled: yes notify: ['Start VDR'] +- name: create directory /etc/systemd/system/vdr.service.d/ + file: + dest: /etc/systemd/system/vdr.service.d/ + state: directory + +- name: add environment file for vdr.service + template: + src: templates/systemd/vdr-environ.j2 + dest: /etc/systemd/system/vdr.service.d/load-environ.conf + - name: Stop xlogin systemd: name: xlogin@vdr.service @@ -1498,6 +1514,11 @@ Wants=x@vt7.service # {{ ansible_managed_file }} exec openbox-session #+END_SRC +**** vdr +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/vdr-environ.j2 +[Service] +EnvironmentFile=-/var/lib/vdr/.session-env +#+END_SRC **** Systemd User Session ***** yavdr-desktop.target #+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/systemd/user/yavdr-desktop.target.j2 :mkdirp yes :padline no diff --git a/roles/nfs-server/tasks/main.yml b/roles/nfs-server/tasks/main.yml index fff57cf..3b93f91 100644 --- a/roles/nfs-server/tasks/main.yml +++ b/roles/nfs-server/tasks/main.yml @@ -14,3 +14,10 @@ src: templates/nfs-exports.j2 dest: /etc/exports notify: [ 'Restart NFS Kernel Server' ] + +- name: populate /etc/avahi/services + template: + src: templates/avahi/service.j2 + dest: '/etc/avahi/services/yavdr-{{ item.key }}.service' + with_dict: + - '{{ media_dirs }}' From 86488b5a79df6dd95d173b5a9f2c20d75931f8d0 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 22 Jun 2017 13:29:20 +0200 Subject: [PATCH 12/23] fix looping over variable --- roles/nfs-server/tasks/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/nfs-server/tasks/main.yml b/roles/nfs-server/tasks/main.yml index 3b93f91..0e96783 100644 --- a/roles/nfs-server/tasks/main.yml +++ b/roles/nfs-server/tasks/main.yml @@ -19,5 +19,4 @@ template: src: templates/avahi/service.j2 dest: '/etc/avahi/services/yavdr-{{ item.key }}.service' - with_dict: - - '{{ media_dirs }}' + with_dict: '{{ media_dirs }}' From 87600748ee72e2ff64d3e1c68dc750308f994234 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 22 Jun 2017 13:29:57 +0200 Subject: [PATCH 13/23] add template for environment loader of vdr.service --- roles/yavdr-xorg/tasks/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/yavdr-xorg/tasks/main.yml b/roles/yavdr-xorg/tasks/main.yml index 9e30d58..f27ff63 100644 --- a/roles/yavdr-xorg/tasks/main.yml +++ b/roles/yavdr-xorg/tasks/main.yml @@ -9,6 +9,16 @@ enabled: yes notify: ['Start VDR'] +- name: create directory /etc/systemd/system/vdr.service.d/ + file: + dest: /etc/systemd/system/vdr.service.d/ + state: directory + +- name: add environment file for vdr.service + template: + src: templates/systemd/vdr-environ.j2 + dest: /etc/systemd/system/vdr.service.d/load-environ.conf + - name: Stop xlogin systemd: name: xlogin@vdr.service From 2a4dc82e21aeca86884f44dfd21b87635fb711cc Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sat, 8 Jul 2017 13:37:35 +0200 Subject: [PATCH 14/23] 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 %} From 9d619500783940749fd4bc1898123249d0baa36c Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sat, 8 Jul 2017 13:38:13 +0200 Subject: [PATCH 15/23] add pulseaudio role --- roles/pulseaudio/tasks/main.yml | 15 +++++++++++++++ roles/pulseaudio/templates/alsa/asound.conf.j2 | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 roles/pulseaudio/tasks/main.yml create mode 100644 roles/pulseaudio/templates/alsa/asound.conf.j2 diff --git a/roles/pulseaudio/tasks/main.yml b/roles/pulseaudio/tasks/main.yml new file mode 100644 index 0000000..36a58af --- /dev/null +++ b/roles/pulseaudio/tasks/main.yml @@ -0,0 +1,15 @@ +--- + +- name: install pulseaudio + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - pulseaudio + - pavucontrol + +- name: create /etc/asound.conf + template: + src: templates/alsa/asound.conf.j2 + dest: /etc/asound.conf diff --git a/roles/pulseaudio/templates/alsa/asound.conf.j2 b/roles/pulseaudio/templates/alsa/asound.conf.j2 new file mode 100644 index 0000000..23e1f11 --- /dev/null +++ b/roles/pulseaudio/templates/alsa/asound.conf.j2 @@ -0,0 +1,14 @@ +# Use PulseAudio by default +pcm.!default { + type pulse + fallback "sysdefault" + hint { + show on + description "Default ALSA Output (currently PulseAudio Sound Server)" + } +} + +ctl.!default { + type pulse + fallback "sysdefault" +} From a27014f07653de87a3f3a2269dd0fcc311f6134c Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sat, 8 Jul 2017 13:45:51 +0200 Subject: [PATCH 16/23] Cleanup --- Manual.org | 17 +++++------------ roles/yavdr-xorg/templates/xorg.conf.j2 | 1 - 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Manual.org b/Manual.org index 6bb643d..bcf6a94 100644 --- a/Manual.org +++ b/Manual.org @@ -1446,8 +1446,11 @@ b'\xde\xad\xbe\xef' enabled: false masked: true -### TODO: Create xorg configuration -- name: create xorg.conf (test) +# TODO: expand template for xorg.conf (or snippets) +# with respect for the available graphics card driver +# nvidia, noveau, intel, radeon + +- name: create xorg.conf (for nvidia driver) template: src: templates/xorg.conf.j2 dest: /etc/X11/xorg.conf @@ -1542,11 +1545,6 @@ b'\xde\xad\xbe\xef' src: roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 dest: '{{ vdr.home }}/.config/systemd/user/tmux.service' -# TODO: run xorg-debug and parse xrandr output -# TODO: expand template for xorg.conf (or snippets) -# with respect for the available graphics card driver -# nvidia, noveau, intel, radeon - - name: enable and start xlogin for the user vdr systemd: daemon_reload: yes @@ -1646,7 +1644,6 @@ Section "Device" Screen 0 EndSection - Section "Screen" Identifier "Screen0" Device "Device0" @@ -1704,10 +1701,6 @@ Section "Screen" EndSubSection EndSection {% endif %} - - - - #+END_SRC #+BEGIN_SRC shell :tangle roles/template-test/templates/xorg.conf_test.j2 diff --git a/roles/yavdr-xorg/templates/xorg.conf.j2 b/roles/yavdr-xorg/templates/xorg.conf.j2 index 6478da8..2c2afe6 100644 --- a/roles/yavdr-xorg/templates/xorg.conf.j2 +++ b/roles/yavdr-xorg/templates/xorg.conf.j2 @@ -38,7 +38,6 @@ Section "Device" Screen 0 EndSection - Section "Screen" Identifier "Screen0" Device "Device0" From 15dd3f24f8433325503e1c03013ddb5492c3daeb Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sat, 15 Jul 2017 14:28:23 +0200 Subject: [PATCH 17/23] Update some descriptions, rearrange order of tasks --- Manual.org | 199 ++++++++++++++++-------------- group_vars/all | 1 + library/xrandr_facts.py | 3 + roles/dvd/tasks/main.yml | 5 + roles/kodi/tasks/main.yml | 5 - roles/pulseaudio/tasks/main.yml | 4 +- roles/vdr/tasks/main.yml | 13 +- roles/yavdr-remote/tasks/main.yml | 21 ++-- roles/yavdr-xorg/tasks/main.yml | 14 +-- yavdr07.yml | 36 +++--- 10 files changed, 160 insertions(+), 141 deletions(-) diff --git a/Manual.org b/Manual.org index bcf6a94..c67b2a9 100644 --- a/Manual.org +++ b/Manual.org @@ -7,8 +7,9 @@ #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: -#+HTML_HEAD: +#+HTML_HEAD: #+HTML_HEAD: + #+OPTIONS: ^:nil # Local Variables: # org-src-preserve-indentation: t @@ -16,6 +17,19 @@ #+PROPERTY: header-args :mkdirp yes :padline no #+TITLE: Ansible Playbooks for yaVDR 0.7 #+Author: Alexander Grothe +# #+LATEX_CLASS: article +#+STARTUP: latexpreview +#+LATEX_CLASS_OPTIONS: [ngerman,a4paper,locale=DE,koma,palatino,DIV=15,BCOR=15mm] +#+LATEX_HEADER: \usepackage[margin=3.0cm]{geometry} +#+LATEX_HEADER: \usepackage[ngerman]{babel} +#+LATEX_HEADER: \usepackage{palatino} +#+LATEX_HEADER: \usepackage{inconsolata} +#+LATEX_HEADER: \usepackage{rotating} +#+LATEX_HEADER: \usepackage{paralist} +#+LATEX_HEADER: \usepackage{booktabs} +#+LATEX_HEADER: \usepackage[locale=DE,seperr,repeatunits=true,trapambigerr=false,tophrase={{ bis }}]{siunitx} +#+LaTeX_HEADER: \usemintedstyle{lovelace} +#+LATEX_HEADER_EXTRA: :END: * User Stories @@ -68,33 +82,34 @@ The lspci(8) utility, in contrast, reports the PCI BusID of a PCI device in the in printf(3) syntax. The "Bus Location" reported in the /proc/driver/nvidia/gpus/0..N/information files matches the lspci format. **** Parsen der /proc/driver/nvidia/gpus/*/information Dateien #+BEGIN_SRC python - # read the BusID for nvidia cards and the model name from the /proc/driver/nvidia/gpus/*/information file(s) - from __future__ import print_function - import glob - import re +# read the BusID for nvidia cards and the model name +# from the /proc/driver/nvidia/gpus/*/information file(s) +from __future__ import print_function +import glob +import re - BusID_RE = re.compile(( - '(?P[0-9a-fA-F]+)' - ':' - '(?P[0-9a-fA-F]+)' - ':' - '(?P[0-9a-fA-F]+)' - '\.' - '(?P[0-9a-fA-F]+)' - )) - Model_RE = re.compile('Model:\s+(.*)') +BusID_RE = re.compile(( + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + ':' + '(?P[0-9a-fA-F]+)' + '\.' + '(?P[0-9a-fA-F]+)' +)) +Model_RE = re.compile('Model:\s+(.*)') - def get_BusIDs(): - for gpu_info in glob.glob('/proc/driver/nvidia/gpus/*/information'): - with open(gpu_info) as f: - data = f.read() - match = BusID_RE.search(data) - if match: - BusID = "{:d}@{:d}:{:d}:{:d}".format(*(int(n, 16) for n in match.groups())) - yield BusID, Model_RE.match(data).groups()[0] - if __name__ == '__main__': - BusIDs = [BusID for BusID in get_BusIDs()] - print(BusIDs) +def get_BusIDs(): + for gpu_info in glob.glob('/proc/driver/nvidia/gpus/*/information'): + with open(gpu_info) as f: + data = f.read() + match = BusID_RE.search(data) + if match: + BusID = "{:d}@{:d}:{:d}:{:d}".format(*(int(n, 16) for n in match.groups())) + yield BusID, Model_RE.match(data).groups()[0] +if __name__ == '__main__': + BusIDs = [BusID for BusID in get_BusIDs()] + print(BusIDs) #+END_SRC ** TODO [#B] plan for customization of xorg settings by the user either directly or using a configuration wizard or a web frontend @@ -148,24 +163,26 @@ The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation: hosts: all become: true roles: - - yavdr-common # install and configure the basic system - - autoinstall-ubuntu-drivers # use ubuntu-drivers to install proprietary dirvers (e.g. nvidia, virtualbox) - - vdr # install vdr and related packages - - yavdr-network # enable network client capabilities - - samba-install # install samba server - - samba-config # configure samba server - - nfs-server # install nfs server - - pulseaudio # install pulseaudio - - yavdr-xorg # graphical session - - yavdr-remote # remote configuration files, services and scripts - - autoinstall-satip # install vdr-plugin-satip if a Sat>IP server has been found - - autoinstall-targavfd # install vdr-plugin-targavfd if display is connected - - autoinstall-imonlcd # install vdr-plugin-imonlcd if a matchind display is connected - #- autoinstall-pv350 # install vdr-plugin-pvr350 if a matching card is detected - #- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected + - yavdr-common # install and configure the basic system + - autoinstall-ubuntu-drivers # use ubuntu-drivers to install proprietary dirvers + # (e.g. nvidia, virtualbox) + - vdr # install vdr and related packages + - yavdr-network # enable network client capabilities + - samba-install # install samba server + - samba-config # configure samba server + - nfs-server # install nfs server + - pulseaudio # install pulseaudio + - yavdr-xorg # graphical session + - yavdr-remote # remote configuration files, services and scripts + - autoinstall-satip # install vdr-plugin-satip if a Sat>IP server has been found + - autoinstall-targavfd # install vdr-plugin-targavfd if display is connected + - autoinstall-imonlcd # install vdr-plugin-imonlcd if a matchind display is connected + - autoinstall-pvr350 # install vdr-plugin-pvr350 if a matching card is detected + - autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected - kodi - - dvd - - grub-config # configure grub + - dvd # set up packages and a udev rule to allow kodi and other players + # to play and eject optical media + - grub-config # configure grub handlers: - include: handlers/main.yml @@ -273,6 +290,7 @@ extra_packages: - vim - tree - w-scan + - bpython - bpython3 #+END_SRC ** System pre-configuration @@ -539,17 +557,14 @@ APT::Install-Suggests "0"; #+END_SRC **** Add svdrp/svdrp-disc to /etc/services #+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes -- name: add svdrp to /etc/services +- name: add svdrp and svdrp-disc to /etc/services lineinfile: dest: /etc/services state: present - line: "svdrp 6419/tcp" - -- name: add svdrp-disc to /etc/services - lineinfile: - dest: /etc/services - state: present - line: "svdrp-disc 6419/udp" + line: "{{ item }}" + with_items: + - "svdrp 6419/tcp" + - "svdrp-disc 6419/udp" #+END_SRC **** Set up the recording directory for the vdr user #+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes @@ -776,7 +791,6 @@ User0 @osdteletext #+END_SRC ** STARTED yavdr-network *** default variables - #+BEGIN_SRC yaml :tangle roles/yavdr-network/main.yml :mkdirp yes :padline no install_avahi: true #+END_SRC @@ -890,19 +904,26 @@ install_avahi: true --- # This role is used to set up the yaVDR remote control configuration. -- name: install yavdr-remote +- name: apt | install yavdr-remote apt: name: yavdr-remote state: present -- name: install lirc +- name: apt | install eventlircd + apt: + name: eventlircd + state: present + when: + install_eventlircd is defined and install_eventlircd + +- name: apt | install lirc apt: name: lircd state: present when: - install_lircd is defined and install_lircd -- name: disable lircd.socket and lircd.service (conflict with eventlircd with default configuration) +- name: stop, mask and disable lircd.socket and lircd.service # (the default lirc configuration conflicts with eventlircd) systemd: name: '{{ item }}' enabled: no @@ -913,14 +934,6 @@ install_avahi: true - lircd.socket ignore_errors: yes -- name: install eventlircd - apt: - name: eventlircd - state: present - when: - install_eventlircd is defined and install_eventlircd - - # TODO: upload lircd2uinput package to PPA #- name: install lircd2uinput # tag: install @@ -938,7 +951,7 @@ install_avahi: true #+BEGIN_SRC yaml :tangle roles/pulseaudio/tasks/main.yml :mkdirp yes :padline no --- -- name: install pulseaudio +- name: apt | install pulseaudio and pavucontrol apt: name: '{{ item }}' state: present @@ -947,7 +960,7 @@ install_avahi: true - pulseaudio - pavucontrol -- name: create /etc/asound.conf +- name: create /etc/asound.conf with pulseaudio as default device template: src: templates/alsa/asound.conf.j2 dest: /etc/asound.conf @@ -1380,11 +1393,13 @@ b'\xde\xad\xbe\xef' name: xlogin@vdr.service state: stopped enabled: yes + ignore_errors: yes - name: Stop x systemd: name: x@vt7.service state: stopped + ignore_errors: yes - name: install packages for xorg apt: @@ -3102,38 +3117,12 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll - '"dvb_ttpci" in modules' notify: [ 'Restart VDR' ] #+END_SRC -** dvd -*** tasks -**** install libdvd-pkg -#+BEGIN_SRC yaml :tangle roles/dvd/tasks/main.yml :mkdirp yes :padline no ---- -# file: roles/dvd/tasks/main.yml - -- name: preconfigure libdvd-pkg - shell: | - echo 'libdvd-pkg libdvd-pkg/post-invoke_hook-install boolean true' | debconf-set-selections - echo 'libdvd-pkg libdvd-pkg/build boolean true' | debconf-set-selections - -- name: apt | install libdvd-pkg - apt: - name: '{{ item }}' - state: present - install_recommends: no - with_items: - - libdvd-pkg -#+END_SRC - ** kodi *** tasks **** Install KODI #+BEGIN_SRC yaml :tangle roles/kodi/tasks/main.yml :mkdirp yes :padline no --- -- name: change udev rule to allow KODI to eject optical disks - shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules - args: - creates: /etc/udev/rules.d/60-cdrom_id.rules - - name: apt | install kodi packages apt: name: '{{ item }}' @@ -3789,6 +3778,31 @@ Restart=on-failure #+END_SRC +** dvd +*** tasks +**** install libdvd-pkg, allow programs to eject optical media +#+BEGIN_SRC yaml :tangle roles/dvd/tasks/main.yml :mkdirp yes :padline no +--- +# file: roles/dvd/tasks/main.yml + +- name: preconfigure libdvd-pkg + shell: | + echo 'libdvd-pkg libdvd-pkg/post-invoke_hook-install boolean true' | debconf-set-selections + echo 'libdvd-pkg libdvd-pkg/build boolean true' | debconf-set-selections + +- name: apt | install libdvd-pkg + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - libdvd-pkg + +- name: change udev rule to allow KODI to eject optical disks + shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules + args: + creates: /etc/udev/rules.d/60-cdrom_id.rules +#+END_SRC ** template-test #+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml :padline no --- @@ -4334,6 +4348,9 @@ EXAMPLES = ''' - debug: var: xrandr + +- debug: + var: xorg ''' ARG_SPECS = { diff --git a/group_vars/all b/group_vars/all index 8d0ffb9..96c1dfa 100644 --- a/group_vars/all +++ b/group_vars/all @@ -49,6 +49,7 @@ extra_packages: - vim - tree - w-scan + - bpython - bpython3 #system: # shutdown: poweroff diff --git a/library/xrandr_facts.py b/library/xrandr_facts.py index 69525a2..103ff27 100755 --- a/library/xrandr_facts.py +++ b/library/xrandr_facts.py @@ -51,6 +51,9 @@ EXAMPLES = ''' - debug: var: xrandr + +- debug: + var: xorg ''' ARG_SPECS = { diff --git a/roles/dvd/tasks/main.yml b/roles/dvd/tasks/main.yml index a819988..4f7a37f 100644 --- a/roles/dvd/tasks/main.yml +++ b/roles/dvd/tasks/main.yml @@ -13,3 +13,8 @@ install_recommends: no with_items: - libdvd-pkg + +- name: change udev rule to allow KODI to eject optical disks + shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules + args: + creates: /etc/udev/rules.d/60-cdrom_id.rules diff --git a/roles/kodi/tasks/main.yml b/roles/kodi/tasks/main.yml index 66ab010..2a7a20e 100644 --- a/roles/kodi/tasks/main.yml +++ b/roles/kodi/tasks/main.yml @@ -1,10 +1,5 @@ --- -- name: change udev rule to allow KODI to eject optical disks - shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules - args: - creates: /etc/udev/rules.d/60-cdrom_id.rules - - name: apt | install kodi packages apt: name: '{{ item }}' diff --git a/roles/pulseaudio/tasks/main.yml b/roles/pulseaudio/tasks/main.yml index 36a58af..c212d7e 100644 --- a/roles/pulseaudio/tasks/main.yml +++ b/roles/pulseaudio/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: install pulseaudio +- name: apt | install pulseaudio and pavucontrol apt: name: '{{ item }}' state: present @@ -9,7 +9,7 @@ - pulseaudio - pavucontrol -- name: create /etc/asound.conf +- name: create /etc/asound.conf with pulseaudio as default device template: src: templates/alsa/asound.conf.j2 dest: /etc/asound.conf diff --git a/roles/vdr/tasks/main.yml b/roles/vdr/tasks/main.yml index 7cb0c46..eef93a1 100644 --- a/roles/vdr/tasks/main.yml +++ b/roles/vdr/tasks/main.yml @@ -10,17 +10,14 @@ - vdr - vdrctl - vdr-plugin-dbus2vdr -- name: add svdrp to /etc/services +- name: add svdrp and svdrp-disc to /etc/services lineinfile: dest: /etc/services state: present - line: "svdrp 6419/tcp" - -- name: add svdrp-disc to /etc/services - lineinfile: - dest: /etc/services - state: present - line: "svdrp-disc 6419/udp" + line: "{{ item }}" + with_items: + - "svdrp 6419/tcp" + - "svdrp-disc 6419/udp" - name: create vdr recdir file: state: directory diff --git a/roles/yavdr-remote/tasks/main.yml b/roles/yavdr-remote/tasks/main.yml index beec35c..cfe20ed 100644 --- a/roles/yavdr-remote/tasks/main.yml +++ b/roles/yavdr-remote/tasks/main.yml @@ -1,19 +1,26 @@ --- # This role is used to set up the yaVDR remote control configuration. -- name: install yavdr-remote +- name: apt | install yavdr-remote apt: name: yavdr-remote state: present -- name: install lirc +- name: apt | install eventlircd + apt: + name: eventlircd + state: present + when: + install_eventlircd is defined and install_eventlircd + +- name: apt | install lirc apt: name: lircd state: present when: - install_lircd is defined and install_lircd -- name: disable lircd.socket and lircd.service (conflict with eventlircd with default configuration) +- name: stop, mask and disable lircd.socket and lircd.service # (the default lirc configuration conflicts with eventlircd) systemd: name: '{{ item }}' enabled: no @@ -24,14 +31,6 @@ - lircd.socket ignore_errors: yes -- name: install eventlircd - apt: - name: eventlircd - state: present - 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 9a84288..1e195cb 100644 --- a/roles/yavdr-xorg/tasks/main.yml +++ b/roles/yavdr-xorg/tasks/main.yml @@ -24,11 +24,13 @@ name: xlogin@vdr.service state: stopped enabled: yes + ignore_errors: yes - name: Stop x systemd: name: x@vt7.service state: stopped + ignore_errors: yes - name: install packages for xorg apt: @@ -90,8 +92,11 @@ enabled: false masked: true -### TODO: Create xorg configuration -- name: create xorg.conf (test) +# TODO: expand template for xorg.conf (or snippets) +# with respect for the available graphics card driver +# nvidia, noveau, intel, radeon + +- name: create xorg.conf (for nvidia driver) template: src: templates/xorg.conf.j2 dest: /etc/X11/xorg.conf @@ -186,11 +191,6 @@ src: roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 dest: '{{ vdr.home }}/.config/systemd/user/tmux.service' -# TODO: run xorg-debug and parse xrandr output -# TODO: expand template for xorg.conf (or snippets) -# with respect for the available graphics card driver -# nvidia, noveau, intel, radeon - - name: enable and start xlogin for the user vdr systemd: daemon_reload: yes diff --git a/yavdr07.yml b/yavdr07.yml index 39f19ce..dcc8f1a 100644 --- a/yavdr07.yml +++ b/yavdr07.yml @@ -6,24 +6,26 @@ hosts: all become: true roles: - - yavdr-common # install and configure the basic system - - autoinstall-ubuntu-drivers # use ubuntu-drivers to install proprietary dirvers (e.g. nvidia, virtualbox) - - vdr # install vdr and related packages - - yavdr-network # enable network client capabilities - - samba-install # install samba server - - samba-config # configure samba server - - nfs-server # install nfs server - - pulseaudio # install pulseaudio - - yavdr-xorg # graphical session - - yavdr-remote # remote configuration files, services and scripts - - autoinstall-satip # install vdr-plugin-satip if a Sat>IP server has been found - - autoinstall-targavfd # install vdr-plugin-targavfd if display is connected - - autoinstall-imonlcd # install vdr-plugin-imonlcd if a matchind display is connected - #- autoinstall-pv350 # install vdr-plugin-pvr350 if a matching card is detected - #- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected + - yavdr-common # install and configure the basic system + - autoinstall-ubuntu-drivers # use ubuntu-drivers to install proprietary dirvers + # (e.g. nvidia, virtualbox) + - vdr # install vdr and related packages + - yavdr-network # enable network client capabilities + - samba-install # install samba server + - samba-config # configure samba server + - nfs-server # install nfs server + - pulseaudio # install pulseaudio + - yavdr-xorg # graphical session + - yavdr-remote # remote configuration files, services and scripts + - autoinstall-satip # install vdr-plugin-satip if a Sat>IP server has been found + - autoinstall-targavfd # install vdr-plugin-targavfd if display is connected + - autoinstall-imonlcd # install vdr-plugin-imonlcd if a matchind display is connected + - autoinstall-pvr350 # install vdr-plugin-pvr350 if a matching card is detected + - autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected - kodi - - dvd - - grub-config # configure grub + - dvd # set up packages and a udev rule to allow kodi and other players + # to play and eject optical media + - grub-config # configure grub handlers: - include: handlers/main.yml From fbd5e88f64d42e46e73ec2d08114db2f0c9f9d86 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sun, 16 Jul 2017 08:02:25 +0200 Subject: [PATCH 18/23] Change order of package installation and stopping xorg-related jobs, so it does not fail because they don't exist yet. --- Manual.org | 23 ++++++++--------------- roles/yavdr-xorg/tasks/main.yml | 23 ++++++++--------------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/Manual.org b/Manual.org index c67b2a9..24f465e 100644 --- a/Manual.org +++ b/Manual.org @@ -1388,19 +1388,6 @@ b'\xde\xad\xbe\xef' src: templates/systemd/vdr-environ.j2 dest: /etc/systemd/system/vdr.service.d/load-environ.conf -- name: Stop xlogin - systemd: - name: xlogin@vdr.service - state: stopped - enabled: yes - ignore_errors: yes - -- name: Stop x - systemd: - name: x@vt7.service - state: stopped - ignore_errors: yes - - name: install packages for xorg apt: name: '{{ item }}' @@ -1417,9 +1404,15 @@ b'\xde\xad\xbe\xef' - read-edid #- yavdr-xorg -- name: "stop x@vt7.service" +- name: Stop xlogin systemd: - name: "x@vt7.service" + name: xlogin@vdr.service + state: stopped + enabled: yesg + +- name: Stop x + systemd: + name: x@vt7.service state: stopped - name: "expand template for x-verbose@.service" diff --git a/roles/yavdr-xorg/tasks/main.yml b/roles/yavdr-xorg/tasks/main.yml index 1e195cb..5085702 100644 --- a/roles/yavdr-xorg/tasks/main.yml +++ b/roles/yavdr-xorg/tasks/main.yml @@ -19,19 +19,6 @@ src: templates/systemd/vdr-environ.j2 dest: /etc/systemd/system/vdr.service.d/load-environ.conf -- name: Stop xlogin - systemd: - name: xlogin@vdr.service - state: stopped - enabled: yes - ignore_errors: yes - -- name: Stop x - systemd: - name: x@vt7.service - state: stopped - ignore_errors: yes - - name: install packages for xorg apt: name: '{{ item }}' @@ -48,9 +35,15 @@ - read-edid #- yavdr-xorg -- name: "stop x@vt7.service" +- name: Stop xlogin systemd: - name: "x@vt7.service" + name: xlogin@vdr.service + state: stopped + enabled: yesg + +- name: Stop x + systemd: + name: x@vt7.service state: stopped - name: "expand template for x-verbose@.service" From 12df1cba571184569abe0c711f30ceb34fff71cf Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sun, 16 Jul 2017 08:03:50 +0200 Subject: [PATCH 19/23] Fix listing of pci cards and gpu filtering --- Manual.html | 4688 +++++++++++++++++++++++++++++++------ Manual.org | 28 +- library/hardware_facts.py | 28 +- 3 files changed, 3994 insertions(+), 750 deletions(-) diff --git a/Manual.html b/Manual.html index 22cd0aa..8aa7e8c 100644 --- a/Manual.html +++ b/Manual.html @@ -3,12 +3,12 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + - +Ansible Playbooks for yaVDR 0.7 - +