2017-02-22 15:27:48 +01:00
# -*- mode: org; -*-
2017-08-31 15:55:04 +02:00
* Settings for Export :noexport:
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: bf0e4a53-06be-4c8c-aa60-be8cb48d790f
:END:
2017-05-12 18:21:26 +02:00
:DOCUMENT_OPTIONS:
2018-11-29 22:43:13 +01:00
#+SETUPFILE : https://fniessen.github.io/org-html-themes/setup/theme-readtheorg.setup
2017-02-20 14:29:15 +01:00
#+OPTIONS : ^:nil
2017-06-21 12:46:51 +02:00
# Local Variables:
# org-src-preserve-indentation: t
# End:
2017-07-08 13:37:35 +02:00
#+PROPERTY : header-args :mkdirp yes :padline no
2017-06-20 15:09:15 +02:00
#+TITLE : Ansible Playbooks for yaVDR 0.7
#+Author : Alexander Grothe <seahawk1986@gmx.de>
2017-07-15 14:28:23 +02:00
#+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}
2017-08-01 10:40:53 +02:00
#+LATEX_HEADER : \renewcommand*\ttdefault{cmvtt}
2017-07-15 14:28:23 +02:00
#+LATEX_HEADER : \usepackage{rotating}
#+LATEX_HEADER : \usepackage{paralist}
#+LATEX_HEADER : \usepackage{booktabs}
2017-08-31 15:55:04 +02:00
#+LATEX_HEADER : \usepackage{titlesec}
2017-07-15 14:28:23 +02:00
#+LATEX_HEADER : \usepackage[locale=DE,seperr,repeatunits=true,trapambigerr=false,tophrase={{ bis }}]{siunitx}
2017-08-01 10:40:53 +02:00
#+LATEX_HEADER : \usemintedstyle{lovelace}
2017-08-31 15:55:04 +02:00
#+LATEX : \defaultfontfeatures{Ligatures=TeX}
#+LATEX_HEADER : \usepackage{parskip}
2017-08-01 10:40:53 +02:00
# #+LATEX_HEADER_EXTRA:
2017-08-31 15:55:04 +02:00
#+EXCLUDE_TAGS : noexport
2017-02-28 17:40:04 +01:00
:END:
2017-05-18 16:06:31 +02:00
2017-06-20 15:09:15 +02:00
* User Stories
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: b698d444-465b-4c57-855a-2abac22c5b7d
:END:
2017-06-20 15:09:15 +02:00
** yavdr-full
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 944c65e5-87d9-4db1-aa0b-dbaae3ba8f13
:END:
2017-06-20 15:09:15 +02:00
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
2017-06-22 12:10:23 +02:00
- pulseaudio :: install and preconfigure pulseaudio
2017-06-20 15:09:15 +02:00
- 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
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a107fd52-172c-4018-8374-8f2ce299f842
:END:
2017-06-20 15:09:15 +02:00
2017-11-09 09:52:00 +01:00
* Notes :noexport:
2017-05-18 16:06:31 +02:00
:PROPERTIES:
2017-11-09 09:52:00 +01:00
:noexport: nil
2018-09-20 09:00:22 +02:00
:ID: 3e321e69-f1c1-4ec3-8f53-1cf714ea1af5
2017-06-20 15:09:15 +02:00
:END:
2017-05-18 16:06:31 +02:00
** TODO [#A] optimize and document data structure for xorg parsing script
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 5aceca9d-016f-45eb-a4bf-7d79dea9c48d
:END:
2017-05-18 16:06:31 +02:00
** TODO [#A] xorg.conf templates for intel, nvidia, noveau and radeon drivers
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: ca82eb6b-e491-4c61-b65f-a394b6b654de
:END:
2017-06-20 15:09:15 +02:00
*** STARTED BusID für (nvidia) Grafikkarten aus lspci auslesen
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e664458a-ad80-4b29-a794-bd433f8d2a22
:END:
2017-06-20 15:09:15 +02:00
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?
2018-05-12 22:10:41 +02:00
*** NVIDIA-Documentation about the BusID:
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4341f6bd-fdec-4dad-8d3b-83b95c20189d
:END:
2017-06-20 15:09:15 +02:00
**** What is the format of a PCI Bus ID?
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 54bf4fd1-3bd2-4752-a0ae-22e90c477235
:END:
2017-06-20 15:09:15 +02:00
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
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9e10199a-5b92-4272-b82d-66a11820a03c
:END:
2017-06-20 15:09:15 +02:00
#+BEGIN_SRC python
2017-07-15 14:28:23 +02:00
# 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<domain >[0-9a-fA-F]+)'
':'
'(?P<bus >[0-9a-fA-F]+)'
':'
'(?P<device >[0-9a-fA-F]+)'
'\.'
'(?P<function >[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)
2017-06-20 15:09:15 +02:00
#+END_SRC
2017-05-18 16:06:31 +02:00
** TODO [#B] plan for customization of xorg settings by the user
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 1b0281a3-1bc7-4b57-936b-f2a13d8723d3
:END:
2017-05-18 16:06:31 +02:00
either directly or using a configuration wizard or a web frontend
** SOMEDAY [#C] select best frontend based on GPU
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 324e03d0-7fe8-4382-be44-7372e14d0b82
:END:
2017-05-18 16:06:31 +02:00
- intel :: softhddevice-vpp
- amd :: softhddevice-vpp
- nvidia :: softhddevice-openglosd (if no HEVC channels are needed)
2017-06-20 15:09:15 +02:00
* Introduction
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 7156cbd8-2071-4e6c-9636-4b84e54cf7be
:END:
2018-05-06 16:32:39 +02:00
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 by 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.
2017-02-20 14:29:15 +01:00
* Installing and configuring yaVDR with Ansible
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a22ce6b4-b251-4293-aa85-78d6dfd6669a
:END:
2017-02-20 14:29:15 +01:00
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 ]].
2017-02-23 13:15:04 +01:00
This Manual is written in org-mode for Emacs and can rewrite the complete ansible configuration if you call ~org-babel-tangle~ from within emacs.
2017-03-13 15:27:21 +01:00
To use this playbook on a Ubuntu Server Installation you need to run the following commands:
#+BEGIN_SRC shell
sudo apt-get install git
git clone https://github.com/yavdr/yavdr-ansible.git
cd yavdr-ansible
2018-01-19 07:49:27 +01:00
git checkout bionic
2017-03-13 15:27:21 +01:00
sudo ./install-yavdr.sh
#+END_SRC
2018-01-03 13:19:59 +01:00
We use a callback to generate tags for all roles autmatically:
#+INCLUDE : "ansible.cfg" src conf
2018-12-31 19:42:02 +01:00
** Install scripts for local usage
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c41eda06-8a67-478e-ae66-cc11f764f279
:END:
2017-03-13 14:53:07 +01:00
#+BEGIN_SRC shell :tangle install-yavdr.sh :shebang "#!/bin/bash"
2018-09-05 12:23:30 +02:00
set -e
2017-03-13 14:53:07 +01:00
if (( $EUID != 0 )); then
2017-12-16 18:02:33 +01:00
echo "This script must be run using sudo -H or as root"
2017-03-13 14:53:07 +01:00
exit
fi
# update packages
2018-09-05 12:23:30 +02:00
apt update
apt -y install software-properties-common
2018-10-05 17:49:39 +02:00
add-apt-repository -y ppa:ansible/ansible-2.7
2018-09-05 12:23:30 +02:00
2017-03-13 14:53:07 +01:00
# install required packages
2018-08-10 10:52:10 +02:00
apt-get -y install --no-install-recommends ansible python-jmespath
2017-03-13 14:53:07 +01:00
# TODO: run ansible on local host
2018-01-07 19:00:27 +01:00
ansible-playbook yavdr07.yml -b -i 'localhost_inventory' --connection=local --tags= "all" --extra-vars "first_run=True"
2018-12-31 19:42:02 +01:00
dpkg-reconfigure libdvd-pkg
#+END_SRC
#+BEGIN_SRC shell :tangle install-yavdr-headless.sh :shebang "#!/bin/bash"
set -e
if (( $EUID != 0 )); then
echo "This script must be run using sudo -H or as root"
exit
fi
# update packages
apt update
apt -y install software-properties-common
add-apt-repository -y ppa:ansible/ansible-2.7
# install required packages
apt-get -y install --no-install-recommends ansible python-jmespath
# TODO: run ansible on local host
ansible-playbook yavdr07-headless.yml -b -i 'localhost_inventory' --connection=local --tags= "all" --extra-vars "first_run=True"
2017-03-13 14:53:07 +01:00
#+END_SRC
2017-02-20 14:29:15 +01:00
* Playbooks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4fa1a3d2-e504-4764-b587-ae9fd0bc7789
:END:
2017-02-23 13:15:04 +01:00
** yavdr07.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 2070ae90-9db7-4e82-bd1a-7320d396bfaf
:END:
2017-03-01 11:59:11 +01:00
The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation:
2017-06-20 16:20:24 +02:00
#+BEGIN_SRC yaml :tangle yavdr07.yml :mkdirp yes :padline no
2017-02-22 15:27:48 +01:00
---
# file: yavdr07.yml
# this playbook sets up a complete yaVDR 0.7 installation
- name: set up yaVDR
hosts: all
become: true
roles:
2017-07-15 14:28:23 +02:00
- yavdr-common # install and configure the basic system
2017-11-20 09:21:22 +01:00
- collect-facts # query system facts
2017-07-15 14:28:23 +02:00
- autoinstall-ubuntu-drivers # use ubuntu-drivers to install proprietary dirvers
# (e.g. nvidia, virtualbox)
2018-01-18 15:16:15 +01:00
# - nvidia-experimental # install very recent nvidia dirver from ppa:graphics-drivers/ppa
2017-07-15 14:28:23 +02:00
- vdr # install vdr and related packages
2018-09-04 13:21:32 +02:00
- autoinstall-virtualbox-guest
2017-07-15 14:28:23 +02:00
- 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
2018-02-12 08:48:12 +01:00
- yavdr-desktop # openbox session with yavdr frontend script
2017-07-15 14:28:23 +02:00
- 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
2018-08-10 08:13:21 +02:00
- autoinstall-pvr350 # install vdr-plugin-pvr350 if a matching card is detected
2017-07-31 00:22:10 +02:00
- autoinstall-hauppauge-pvr # install vdr-plugin-pvrinput if a matching card is found
2017-07-15 14:28:23 +02:00
- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected
2017-11-13 09:46:51 +01:00
- autoinstall-hardware-irmp # install yavdr-hardware-irmp if a matching usb device is detected
2018-01-01 22:51:57 +01:00
- autoinstall-atric-usb # preconfigure lircd for Atric IR-WakeupUSB receiver
2018-01-16 09:12:11 +01:00
- autoinstall-yausbir # preconfigure lircd for yaUsbIR receiver
2018-08-10 08:13:21 +02:00
- autoinstall-dvbsky-firmware # download and install required firmware files for dvbsky cards
- autoinstall-firmware # download and install firmware files for dvb devices
2019-01-02 09:26:56 +01:00
#- serial-ir # configure a serial port for "homebrew" ir receivers (e.g. Atric V5)
2017-06-20 15:09:15 +02:00
- kodi
2017-07-15 14:28:23 +02:00
- dvd # set up packages and a udev rule to allow kodi and other players
# to play and eject optical media
2017-11-20 09:45:15 +01:00
- wakeup # set up wakeup methods for rtc etc.
2017-07-15 14:28:23 +02:00
- grub-config # configure grub
2017-02-23 13:15:04 +01:00
handlers:
2017-11-12 19:07:21 +01:00
- import_tasks: handlers/main.yml
2017-02-20 14:29:15 +01:00
#+END_SRC
2017-02-23 13:15:04 +01:00
** yavdr07-headless.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c13a8871-5fe1-48cd-ae63-93a3641f93c1
:END:
2017-02-23 13:15:04 +01:00
For a headless server installation ~yavdr07-headless.yml~ is a good choice
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle yavdr07-headless.yml :mkdirp yes :padline no
2017-02-23 13:15:04 +01:00
---
# file: yavdr07-headless.yml
# this playbook set up a headless yaVDR 0.7 installation
2017-02-20 14:29:15 +01:00
2017-02-23 13:15:04 +01:00
- name: set up a headless yaVDR server
hosts: all
become: true
roles:
- yavdr-common
2017-11-20 09:21:22 +01:00
- collect-facts # query system facts
2017-02-23 13:15:04 +01:00
- vdr
- yavdr-network
2018-02-12 08:48:12 +01:00
- samba-install
2017-02-23 13:15:04 +01:00
- samba-config
- nfs-server
- grub-config
2018-08-10 08:13:21 +02:00
- autoinstall-satip # install vdr-plugin-satip if a Sat>IP server has been found
- autoinstall-pvr350 # install vdr-plugin-pvr350 if a matching card is detected
- autoinstall-hauppauge-pvr # install vdr-plugin-pvrinput if a matching card is found
- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected
- autoinstall-dvbsky-firmware # download and install required firmware files for dvbsky cards
- autoinstall-firmware # download and install firmware files for dvb devices
2017-11-20 09:45:15 +01:00
- wakeup
2017-07-30 15:21:05 +02:00
tags:
- always
2017-02-23 13:15:04 +01:00
handlers:
2017-11-12 19:07:21 +01:00
- import_tasks: handlers/main.yml
2017-02-23 13:15:04 +01:00
#+END_SRC
2017-02-20 14:29:15 +01:00
* Hosts
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 552370c6-7ee3-4fa4-9244-957dce8abb8e
:END:
2017-02-20 14:29:15 +01:00
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:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC conf :tangle localhost_inventory :mkdirp yes :padline no
2017-11-12 21:17:44 +01:00
[local]
2017-03-01 11:59:11 +01:00
localhost connection=local
2017-02-20 14:29:15 +01:00
2017-02-22 15:27:48 +01:00
#+END_SRC
* Group Variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4cdb74a4-5ad2-47f4-b0ed-bd65fc8fc65f
:END:
2018-01-16 13:07:01 +01:00
** PPAs
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: dbae36e3-610a-4abc-aa76-5a6fc75edb9b
:END:
2018-01-16 13:07:01 +01:00
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
2017-06-21 12:46:51 +02:00
---
2017-02-23 13:15:04 +01:00
# file: group_vars/all
2017-12-16 16:33:15 +01:00
branch: experimental
2017-02-22 15:27:48 +01:00
ppa_owner: 'ppa:yavdr'
2017-07-30 14:54:43 +02:00
# add the following PPAs
2017-02-22 15:27:48 +01:00
repositories:
2017-12-16 16:33:15 +01:00
- '{{ ppa_owner }}/{{branch}}-main'
2017-02-22 15:27:48 +01:00
- '{{ ppa_owner }}/{{branch}}-vdr'
2017-12-16 16:33:15 +01:00
#- '{{ ppa_owner }}/{{branch}}-yavdr'
#- '{{ ppa_owner }}/{{branch}}-kodi'
2017-03-01 21:11:56 +01:00
#+END_SRC
** VDR user, directories, special configuration and plugins
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 6b9a4009-32f6-431f-8c5f-1f0199755dde
:END:
2017-03-01 21:11:56 +01:00
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
2017-02-23 13:15:04 +01:00
# properties of the user vdr and vdr-related options
2018-02-12 16:37:41 +01:00
# NOTE: user name, uid and confdir must match the values set by the vdr package
2017-02-22 15:27:48 +01:00
vdr:
user: vdr
group: vdr
uid: 666
gid: 666
home: /var/lib/vdr
2017-07-08 13:37:35 +02:00
confdir: /var/lib/vdr
2017-02-22 15:27:48 +01:00
recdir: /srv/vdr/video
hide_first_recording_level: false
2017-03-13 10:40:35 +01:00
safe_dirnames: true # escape characters (useful for windows clients and FAT/NTFS file systems)
2017-02-22 15:27:48 +01:00
override_vdr_charset: false
2017-02-23 13:15:04 +01:00
# add the vdr plugins you want to install
2017-02-22 15:27:48 +01:00
vdr_plugins:
- vdr-plugin-devstatus
- vdr-plugin-markad
2017-06-19 07:51:19 +02:00
- vdr-plugin-softhddevice-vpp
2017-03-01 21:11:56 +01:00
#+END_SRC
2017-03-13 10:40:35 +01:00
** Media directories
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: eb002b3a-d1c9-4d57-9913-97ab2a85e568
:END:
2017-03-13 10:40:35 +01:00
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
# dictionary of directories for (shared) files. Automatically exported via NFS and Samba if those roles are enabled
media_dirs:
audio: /srv/audio
2017-12-17 09:16:50 +01:00
video: /srv/video
2017-03-13 10:40:35 +01:00
pictures: /srv/picture
files: /srv/files
backups: /srv/backups
recordings: '{{ vdr.recdir }}'
#+END_SRC
** NFS
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 3a5a4687-36a1-496f-929b-7455917abcf4
:END:
2017-03-13 10:40:35 +01:00
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
nfs:
2017-03-16 10:26:32 +01:00
insecure: false # set to true for OS X clients or if you plan to use libnfs as unprivileged user (e.g. KODI)
2017-03-13 10:40:35 +01:00
#+END_SRC
2017-03-01 21:11:56 +01:00
** Samba
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a796849f-6bde-41db-b92b-57e328697480
:END:
2017-03-01 21:11:56 +01:00
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
2017-02-23 13:15:04 +01:00
samba:
workgroup: YAVDR
2017-03-16 10:26:32 +01:00
windows_compatible: '{{ vdr.safe_dirnames }}' # set to true to disable unix extensions, enable follow symlinks and wide links
2017-03-01 21:11:56 +01:00
#+END_SRC
** Additional packages
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 68883dc3-9bab-42d3-a7eb-0d4cbd747711
:END:
2017-03-01 21:11:56 +01:00
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
2017-02-23 13:15:04 +01:00
# additional packages you want to install
2017-02-22 15:27:48 +01:00
extra_packages:
2017-11-09 09:50:00 +01:00
- bpython
- bpython3
2017-07-16 08:29:13 +02:00
- htop
2017-02-22 15:27:48 +01:00
- tree
2017-11-09 09:50:00 +01:00
- vim
2017-02-22 15:27:48 +01:00
- w-scan
2017-12-26 12:58:29 +01:00
- plymouth-theme-yavdr-logo
2017-03-01 21:11:56 +01:00
#+END_SRC
** System pre-configuration
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4fd6c8f3-e7bc-4dbc-ad12-5faadb74516a
:END:
2017-03-01 21:11:56 +01:00
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
2017-07-16 09:27:04 +02:00
frontend: vdr
2017-03-03 10:39:59 +01:00
#system:
# shutdown: poweroff
2017-11-20 09:45:15 +01:00
wakeup_method: acpiwakeup
2017-03-13 10:40:35 +01:00
grub:
timeout: 0
2017-12-26 12:58:29 +01:00
boot_options: quiet splash
2017-02-20 14:29:15 +01:00
#+END_SRC
2019-01-02 09:26:56 +01:00
** Serial IR
#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes
# Serial device to configure for a homebrew receiver.
# Choose either ttyS0 (COM1) or ttyS1 (COM2)
2019-01-02 10:13:18 +01:00
# Also ensure that the role serial-ir is enabled in yavdr07.yml
serial_ir_device: ttyS0
2019-01-02 09:26:56 +01:00
#+END_SRC
2017-02-20 14:29:15 +01:00
* Roles
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 50ac2e79-c494-4a32-8632-313d49bdb2b7
:END:
2017-06-20 15:09:15 +02:00
** install-dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 5b6afb72-fabe-4cfc-b61e-ed40bd05396a
:END:
2017-06-20 15:09:15 +02:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 928993cf-fa67-4eae-8bb3-1d09bbceb704
:END:
2017-06-20 15:09:15 +02:00
**** main.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9d20ce2f-a503-4f50-8fe2-97517da6557f
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/install-packages/tasks/main.yml :mkdirp yes :padline no
2017-06-20 15:09:15 +02:00
---
- name: apt | install packages
apt:
2018-10-05 17:49:39 +02:00
name: '{{ packages }}'
2017-06-20 15:09:15 +02:00
state: present
install_recommends: no
2018-04-06 09:06:03 +02:00
cache_valid_time: 60
2017-06-20 15:09:15 +02:00
#+END_SRC
2018-01-18 15:17:26 +01:00
** nvidia experimental drivers
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 32fdd667-36a0-4dc8-a94f-cbb2bf24ef75
:END:
2018-05-20 09:13:23 +02:00
install nvidia-396 from ppa:graphics-drivers/ppa
2017-06-20 15:09:15 +02:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: efc51a02-dbf3-4421-a1a8-fd0b5dab1a5c
:END:
2017-06-20 15:09:15 +02:00
**** main.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 27504b06-bf0f-4b0a-8756-8d6d1cc23abf
:END:
2018-01-18 15:15:23 +01:00
#+BEGIN_SRC yaml :tangle roles/nvidia-experimental/tasks/main.yml :mkdirp yes :padline no
2017-06-20 15:09:15 +02:00
---
- name: add ppa:graphics-drivers/ppa
apt_repository:
repo: 'ppa:graphics-drivers/ppa'
state: present
update_cache: yes
2017-12-28 17:28:43 +01:00
tags:
- ppa
2017-06-20 15:09:15 +02:00
2018-05-20 09:13:23 +02:00
- name: install nvidia-396 and other required packages
2017-06-20 15:09:15 +02:00
apt:
2018-10-05 17:49:39 +02:00
name:
-nvidia-396
-nvidia-settings
2017-06-20 15:09:15 +02:00
state: present
install_recommends: no
2017-12-28 17:28:43 +01:00
tags:
- packages
2017-06-20 15:09:15 +02:00
#+END_SRC
2017-02-20 14:29:15 +01:00
** yavdr-common
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 83814b17-9170-4b92-8b3b-4ee87f9eee26
:END:
2017-02-20 14:29:15 +01:00
This role is used to set up a basic yaVDR installation. It creates the directories, installs the vdr and other useful packages.
2017-02-22 15:27:48 +01:00
*** default variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 61465f32-6b30-43a0-804a-032256acbb18
:END:
2017-03-01 11:59:11 +01:00
This section is for reference only, please use the files in ~global_vars~ for customizations.
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/defaults/main.yml :mkdirp yes :padline no
2017-02-22 15:27:48 +01:00
---
# file: roles/yavdr-common/defaults/main.yml
2017-03-01 11:59:11 +01:00
#+END_SRC
2017-02-22 15:27:48 +01:00
2017-03-01 11:59:11 +01:00
**** Repositories
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c78ea666-ecff-4360-89e7-543df5e980a9
:END:
2017-03-01 11:59:11 +01:00
You can set a list of package repositories which provide the necessary packages. Feel free to use own PPAs if you need special customization to the VDR and it's plugins.
2017-07-28 16:09:11 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/defaults/main.yml :mkdirp yes :padline yes
2017-02-22 15:27:48 +01:00
branch: unstable
repositories:
- 'ppa:yavdr/main'
- 'ppa:yavdr/unstable-main'
- 'ppa:yavdr/{{branch}}-vdr'
- 'ppa:yavdr/{{branch}}-kodi'
- 'ppa:yavdr/{{branch}}-yavdr'
2017-02-20 14:29:15 +01:00
#+END_SRC
**** Drivers
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0ec042d9-e535-42f2-8996-4322e12ba171
:END:
2017-02-22 15:27:48 +01:00
Automatically installed drivers can be very useful, but if you know you need a certain driver, you can simply set it's value to *true* . If you don't want a driver to be installed, set it's value to *false* .
2017-07-28 16:09:11 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/defaults/main.yml :mkdirp yes :padline yes
2017-02-20 14:29:15 +01:00
drivers:
2017-02-22 15:27:48 +01:00
sundtek: auto
ddvb-dkms: auto
2017-02-20 14:29:15 +01:00
#+END_SRC
**** Additional Packages
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 01776db6-487d-4926-9032-bf2c802cf537
:END:
2017-02-22 15:27:48 +01:00
Add additional packages you would like to have on your installation to this list
2017-07-28 16:09:11 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/defaults/main.yml :mkdirp yes :padline yes
extra_packages:
- vim
- tree
- w-scan
2017-02-20 14:29:15 +01:00
#+END_SRC
**** VDR
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 865faeec-1c2b-43ca-9a72-99aa59a78a74
:END:
2017-02-20 14:29:15 +01:00
This section allows you to set the recording directory, the user and group that runs the vdr and it's home directory.
- user :: the vdr user name
- group :: the main group for the user vdr
- uid :: the user id for the user vdr
- gid :: the group id for the group vdr
- home :: the home directory for the user vdr
- recdir :: the recording directory used by VDR
- hide_first_recording_level :: let vdr hide the first directory level of it's recording directory so the content of multiple directories is shown merged together
- safe_dirnames :: replace special characters which are not compatible with Windows file systems and Samba shares
- override_vdr_charset :: workaround for channels with weird EPG encodings, e.g. Sky
2017-07-28 16:09:11 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/defaults/main.yml :mkdirp yes :padline yes
2017-02-20 14:29:15 +01:00
vdr:
user: vdr
group: vdr
uid: 666
gid: 666
home: /var/lib/vdr
recdir: /srv/vdr/video
2017-02-22 15:27:48 +01:00
hide_first_recording_level: false
2017-02-20 14:29:15 +01:00
safe_dirnames: true
override_vdr_charset: false
#+END_SRC
2017-02-22 15:27:48 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 64dc0a0b-48b4-48f7-b92f-0c52db61e0c0
:END:
2017-02-20 14:29:15 +01:00
yavdr-common executes the following tasks:
2017-02-28 16:31:11 +01:00
**** main.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 91c2ffd5-6dc9-4cbc-b50a-525bf0e79a34
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes :padline no
---
# file: roles/yavdr-common/tasks/main.yml
- name: basic installation
block:
- import_tasks: configure_apt.yml
- import_tasks: configure_system.yml
- import_tasks: create_directories.yml
2018-05-23 09:55:57 +02:00
- import_tasks: create_sudoers.yml
2018-10-27 14:46:53 +02:00
- import_tasks: standby_support.yml
2017-11-20 09:21:22 +01:00
tags: [install]
#+END_SRC
2017-02-28 16:31:11 +01:00
***** Disable default installation of recommended packages
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9ffe98b0-452a-463b-a29e-507cb519533e
:END:
2017-03-01 11:59:11 +01:00
This task prevents apt to automatically install all recommended dependencies for packages:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_apt.yml :mkdirp yes :padline no
2017-06-21 12:46:51 +02:00
---
2017-03-02 09:06:19 +01:00
- name: apt | prevent automatic installation of recommended packages
template:
src: templates/90-norecommends.j2
dest: /etc/apt/apt.conf.d/90norecommends
2017-02-23 13:15:04 +01:00
2017-02-28 16:31:11 +01:00
#+END_SRC
2017-11-20 09:21:22 +01:00
***** Set up package repositories
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9e37b558-6748-4b07-aefc-5528bfa337ab
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_apt.yml :mkdirp yes
- name: add PPAs
apt_repository:
repo: '{{ item }}'
state: present
2018-08-03 12:07:33 +02:00
update_cache: no
2017-11-20 09:21:22 +01:00
with_items: '{{ repositories }}'
2017-12-28 17:28:43 +01:00
tags:
- ppa
2017-11-20 09:21:22 +01:00
- name: run apt-get dist-upgrade
apt:
upgrade: dist
update_cache: yes
#+END_SRC
2017-03-03 00:35:14 +01:00
***** Use bash instead of dash
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 2a09027d-cb5a-4957-98ed-6140d495b048
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml :mkdirp yes
2018-08-09 10:07:20 +02:00
- name: use bash instead of dash
shell: |
echo "set dash/sh false" | debconf-communicate
dpkg-reconfigure -f noninteractive dash
2017-03-03 00:35:14 +01:00
#+END_SRC
2017-03-13 14:53:07 +01:00
***** create user vdr
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c3a9bb0e-51e1-472a-b1c9-14215a7a3e5c
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml :exports none :mkdirp yes
2017-03-13 14:53:07 +01:00
- name: create vdr group
group:
gid: '{{ vdr.gid }}'
state: present
name: '{{ vdr.group }}'
- name: create vdr user
user:
name: '{{ vdr.user }}'
group: '{{ vdr.group }}'
uid: '{{ vdr.uid }}'
home: '{{ vdr.home }}'
shell: '/bin/bash'
state: present
append: true
#+END_SRC
2017-03-03 00:35:14 +01:00
***** Disable release-upgrade notifications
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e4269c24-0273-4221-b6ca-a429cd2cf4f1
:END:
2017-11-22 11:37:20 +01:00
****** SOMEDAY move from lineinfile to template
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 43ed1009-31df-4eae-81b2-133261f7e6b4
:END:
2017-11-22 11:37:20 +01:00
:LOGBOOK:
- State "SOMEDAY" from "TODO" [2017-11-22 Mi 10:59]
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml :mkdirp yes
2017-03-03 00:35:14 +01:00
- name: disable release-upgrade notifications
lineinfile:
dest: /etc/update-manager/release-upgrades
backrefs: yes
state: present
regexp: '^(Prompt=).*$'
line: '\1never'
2017-11-22 10:56:21 +01:00
ignore_errors: yes
2017-11-22 11:37:20 +01:00
with_first_found:
2017-11-22 11:40:17 +01:00
- files:
2017-11-22 11:37:20 +01:00
- /etc/update-manager/release-upgrades
skip: true
2017-03-02 09:06:19 +01:00
2017-03-03 00:35:14 +01:00
#+END_SRC
2017-03-13 10:40:35 +01:00
***** Install essential packages
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: aa6d9c2d-f052-4ca2-a55e-b31fe04b11e1
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml :mkdirp yes
2017-03-02 09:06:19 +01:00
- name: apt | install basic packages
apt:
2018-10-05 17:49:39 +02:00
name:
- anacron
- acl
- at
- bash-completion
#- biosdevname # caution: may change device names after a minimal installation!
- debconf-utils
- linux-firmware
- psmisc
- python-kmodpy
- python-requests
- python-usb
- python3-usb
- software-properties-common
- ssh
- wget
- wpasupplicant
- usbutils
- xfsprogs
2017-03-02 09:06:19 +01:00
state: present
install_recommends: no
2017-02-28 16:31:11 +01:00
#+END_SRC
2017-03-13 10:40:35 +01:00
***** Install additional packages (user defined)
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 8b0832b1-0d61-4329-942d-b3bb3e6ada0a
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml
2017-03-13 10:40:35 +01:00
- name: apt | install extra packages
apt:
2018-10-05 17:49:39 +02:00
name: '{{ extra_packages }}'
2017-03-13 10:40:35 +01:00
state: present
install_recommends: no
2018-10-05 17:49:39 +02:00
2017-03-13 10:40:35 +01:00
#+END_SRC
2017-11-22 10:09:51 +01:00
***** create directories
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0b1784e5-6573-4377-903d-6501604eedf8
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/create_directories.yml :exports none :mkdirp yes
2017-11-22 10:09:51 +01:00
- name: ensure /etc/yavdr exists
2017-11-22 10:15:16 +01:00
file:
2017-11-22 10:09:51 +01:00
path: /etc/yavdr
state: directory
mode: 0755
2017-03-13 14:53:07 +01:00
- name: create media directories
file:
dest: '{{ item.value }}'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
state: directory
mode: '0777'
with_dict: '{{ media_dirs }}'
#+END_SRC
2018-05-23 09:55:57 +02:00
***** create sudoers drop-in for vdr
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: ccb5824a-4436-4956-a02c-9538256129cf
:END:
2018-05-23 09:55:57 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/create_sudoers.yml :exports none :mkdirp yes
- name: create /etc/sudoers.d/yavdr from template
template:
src: templates/yavdr.sudoers.j2
dest: /etc/sudoers.d/yavdr
mode: '0444'
validate: visudo -cf %s
#+END_SRC
2018-10-27 14:46:53 +02:00
***** basic scripts for standby support
Stop vdr before entering suspend and unload dvb modules, reverse this operation on resume
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/standby_support.yml :exports none :mkdirp yes
- name: create /usr/local/bin/module-helper
template:
2018-10-27 14:58:22 +02:00
src: templates/module-helper.j2
2018-10-27 14:46:53 +02:00
dest: /usr/local/bin/module-helper
mode: '0755'
- name: create standby hooks /lib/systemd/system-sleep/yavdr
template:
src: templates/system-sleep_yavdr.j2
dest: /lib/systemd/system-sleep/yavdr
mode: '0755'
#+END_SRC
2017-02-23 13:15:04 +01:00
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 48c1e3f9-5edf-409a-b826-629eac9ee4b4
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC c :tangle roles/yavdr-common/templates/90-norecommends.j2 :mkdirp yes :padline no
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment('c') }}
2017-02-23 13:15:04 +01:00
// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";
#+END_SRC
2018-05-23 09:55:57 +02:00
**** yavdr sudoers drop-in
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 8667f68e-9805-4f13-a0cc-28f3393d2687
:END:
2018-05-23 09:55:57 +02:00
Allow the vdr user to restart ~vdr.service~ and reboot the system
#+BEGIN_SRC shell :tangle roles/yavdr-common/templates/yavdr.sudoers.j2 :mkdirp yes :padline no
{{ vdr.user }} ALL=NOPASSWD: /bin/systemctl --no-block restart vdr.service
{{ vdr.user }} ALL=NOPASSWD: /bin/systemctl --no-block reboot
#+END_SRC
2018-10-27 14:46:53 +02:00
**** suspend hooks
#+BEGIN_SRC shell :tangle roles/yavdr-common/templates/system-sleep_yavdr.j2 :mkdirp yes :padline no
2019-01-02 17:16:11 +01:00
#!/bin/bash
2018-10-27 14:46:53 +02:00
{{ ansible_managed | comment }}
case $1 in
pre)
/bin/systemctl stop vdr
/usr/local/bin/module-helper -u dvb_core
;;
post)
2019-01-02 17:16:11 +01:00
# reload rc-core keytables
2019-01-02 17:22:33 +01:00
[ -x /usr/bin/ir-keytable ] && {
for remote in $(ir-keytable 2>&1 | grep rc/rc | egrep -o "rc[0-9]{1,}")
do
ir-keytable -a /etc/rc_maps.cfg --sysdev $remote
done
}
2019-01-02 17:16:11 +01:00
2018-10-27 14:46:53 +02:00
/usr/local/bin/module-helper -r
/bin/systemctl start vdr
;;
esac
#+END_SRC
**** module-helper
#+BEGIN_SRC python :tangle roles/yavdr-common/templates/module-helper.j2 :mkdirp yes :padline no
#!/usr/bin/env python3
2018-10-27 15:04:34 +02:00
# {{ ansible_managed | comment }}
2018-10-27 14:46:53 +02:00
# based on http://www.e-tobi.net/blog/files/module-helper
# http://www.e-tobi.net/blog/2010/11/06/squeeze-vdr-teil-9-suspend-to-ram
# ported to python3 by Alexander Grothe
#
# This script resolves linux kernel module dependencies automatically, so only
# the base module has to be specified (e.g. dvb_core)
import argparse
import subprocess
import pickle
dependency_map = {}
def find_dependencies(module, dependencies=[]):
dependencies.append(module)
if module in dependency_map:
for dependency in dependency_map[module]:
find_dependencies(dependency, dependencies)
return dependencies
def build_module_dependency_map():
with subprocess.Popen(['lsmod'],
stdout=subprocess.PIPE,
universal_newlines=True
) as p:
for line in p.stdout:
values = line.split()
if len(values) > 3:
#print("module {} depends on {}".format(values[0], values[3]))
dependency_map[values[0]] = values[3].split(',')
def run_command_on_module_list(command, module_list):
for module in module_list:
cmd = [command, module]
subprocess.call(cmd)
def create_argparser():
parser = argparse.ArgumentParser(description= "load or unload modules")
group = parser.add_mutually_exclusive_group()
group.add_argument('-u', '--unload', metavar='MODULE', nargs= '+',
help='unload modules')
group.add_argument('-r', '--reload', action='store_true',
help='reload modules')
parser.add_argument('-t', '--temp-file', nargs='?',
default='/tmp/modules.list',
help='''store names of unloaded modules in a file,
default location is /tmp/modules.list''')
return parser
if __name__ == '__main__':
parser = create_argparser()
args = parser.parse_args()
if args.unload:
build_module_dependency_map()
all_modules = []
for module in args.unload:
all_modules.extend(find_dependencies(module))
all_modules.reverse()
try:
with open(args.temp_file, 'wb') as f:
pickle.dump(all_modules, f)
run_command_on_module_list('rmmod', all_modules)
except Exception as e:
print(e)
pass
elif args.reload:
with open(args.temp_file, 'rb') as f:
all_modules = pickle.load(f)
run_command_on_module_list('modprobe', all_modules)
else:
parser.print_help()
#+END_SRC
2017-11-20 09:21:22 +01:00
** collect facts about the system with custom modules
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 6fb47bef-2511-4d82-b5ef-5cdfac62087f
:END:
2018-01-07 18:45:01 +01:00
*** variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 348d726a-1030-4fa9-b791-ced571a71d36
:END:
2018-01-07 18:45:01 +01:00
#+BEGIN_SRC yaml :tangle roles/collect-facts/defaults/main.yml :mkdirp yes
2018-01-07 19:00:27 +01:00
first_run: False
2018-01-07 18:45:01 +01:00
#+END_SRC
2017-11-20 09:21:22 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0ca02941-519a-4ea0-8097-c93c5249980e
:END:
2017-11-20 09:21:22 +01:00
***** main.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 7cbaa7cc-ce6e-4713-85ed-dd083bbb3895
:END:
2017-11-20 09:21:22 +01:00
#+BEGIN_SRC yaml :tangle roles/collect-facts/tasks/main.yml :mkdirp yes
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True
pci: True
modules: True
gpus: True
acpi_power_modes: True
2017-12-28 17:28:43 +01:00
tags:
- always
2017-11-21 11:30:03 +01:00
2017-11-20 09:21:22 +01:00
- debug:
var: '{{ item }}'
verbosity: 1
with_items:
- usb
- pci
- gpus
- modules
- acpi_power_modes
2017-11-21 11:30:03 +01:00
- nvidia_detected
- intel_detected
- amd_detected
2017-11-22 09:24:33 +01:00
- virtualbox_detected
2018-01-01 22:39:10 +01:00
2018-08-10 09:06:15 +02:00
- name: get detailed PCI device information
pci_facts:
tags:
- always
- debug:
var: pci_devices
2018-08-10 09:09:34 +02:00
verbosity: 1
2018-08-10 09:06:15 +02:00
2018-01-01 22:39:10 +01:00
- name: known vdr output plugins
2018-01-01 22:42:58 +01:00
set_fact:
2018-01-01 22:39:10 +01:00
vdr_output_plugins:
- softhddevice
- xineliboutput
- xine
2017-11-20 09:21:22 +01:00
#+END_SRC
2017-02-22 15:27:48 +01:00
** vdr
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 75c016f6-a5e1-4c27-af0a-6cdcfe3db877
:END:
2017-02-22 15:27:48 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: b7a3bd2d-fa19-4c79-809c-acc8c92f2a43
:END:
2017-03-01 21:11:56 +01:00
**** install the basic vdr packages
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0531de50-21f9-41ea-a0b1-9e808e6d0e9f
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes :padline no
2017-03-02 09:06:19 +01:00
---
# file: roles/vdr/tasks/main.yml
2017-03-01 21:11:56 +01:00
2017-03-02 09:06:19 +01:00
- name: apt | install basic vdr packages
apt:
2018-10-05 17:49:39 +02:00
name:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
2017-03-02 09:06:19 +01:00
state: present
install_recommends: no
2017-03-01 21:11:56 +01:00
#+END_SRC
**** Add svdrp/svdrp-disc to /etc/services
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e44d3ba8-886a-4d97-a9dc-f141ecba2ccd
:END:
2017-03-01 21:11:56 +01:00
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
2017-07-15 14:28:23 +02:00
- name: add svdrp and svdrp-disc to /etc/services
2017-03-02 09:06:19 +01:00
lineinfile:
dest: /etc/services
state: present
2017-07-15 14:28:23 +02:00
line: "{{ item }}"
with_items:
- "svdrp 6419/tcp"
- "svdrp-disc 6419/udp"
2017-03-01 21:11:56 +01:00
#+END_SRC
**** Set up the recording directory for the vdr user
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 7dd1b799-0a41-444f-834d-a368a5bc38f8
:END:
2017-03-01 21:11:56 +01:00
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
2017-03-02 09:06:19 +01:00
- name: create vdr recdir
file:
state: directory
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0775
dest: '{{ vdr.recdir }}'
- name: set option to use hide-first-recording-level patch
blockinfile:
dest: /etc/vdr/conf.d/04-vdr-hide-first-recordinglevel.conf
create: true
2017-12-19 20:10:39 +01:00
state: "{{ 'present' if vdr.hide_first_recording_level else 'absent' }}"
2017-03-02 09:06:19 +01:00
block: |
[vdr]
--hide-first-recording-level
- name: create local dir in recdir
file:
state: directory
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: '0775'
dest: '{{ vdr.recdir }}/local'
when:
vdr.hide_first_recording_level
2017-03-13 14:53:07 +01:00
# TODO: set recdir, user etc. in /etc/vdr/conf.d/
2017-03-01 21:11:56 +01:00
#+END_SRC
**** Install additional vdr plugins
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9d44b9ce-308b-4388-bc55-a93bbded261f
:END:
2017-03-01 21:11:56 +01:00
The additional plugins to install can be set in the variable ~{{vdr_plugins}}~ in the group variables
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
2017-03-13 15:27:21 +01:00
- name: apt | install additional vdr plugins
2017-03-02 09:06:19 +01:00
apt:
2018-10-05 17:49:39 +02:00
name: '{{ vdr_plugins | default([]) }}'
2017-03-02 09:06:19 +01:00
state: present
install_recommends: no
2017-03-13 15:27:21 +01:00
notify: [ 'Restart VDR' ]
2017-02-20 14:29:15 +01:00
#+END_SRC
2017-07-08 13:37:35 +02:00
**** copy vdr configuration files (if they don't exist yet)
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: d89c1baa-2aff-495f-b74b-64431d9fa4ba
:END:
2017-06-21 12:46:51 +02:00
#+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' ]
2017-07-08 13:37:35 +02:00
- 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'
2017-06-21 12:46:51 +02:00
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0644
2017-07-08 13:37:35 +02:00
force: no
2017-06-21 12:46:51 +02:00
#+END_SRC
2018-02-12 10:27:01 +01:00
**** start vdr after network-online.target
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e435efbc-0690-40cc-bf55-5516b23f4ccf
:END:
2018-02-12 10:27:01 +01:00
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
2018-02-12 13:09:57 +01:00
- name: create directory for vdr.service systemd drop-in files
file:
dest: '{{ item }}'
state: directory
with_items:
- "/etc/systemd/system/vdr.service.d/ "
2018-02-12 10:27:01 +01:00
- name: systemd-drop-in | start vdr.service after network-online.target
template:
src: templates/systemd/network-online.j2
dest: /etc/systemd/system/vdr.service.d/network-online.conf
#+END_SRC
2017-06-21 12:46:51 +02:00
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0c5c2e3b-57af-46a9-b69e-3499e25fce59
:END:
2018-02-12 10:27:01 +01:00
Start after network-online.target
#+BEGIN_SRC conf :tangle roles/vdr/templates/systemd/network-online.j2 :mkdirp yes
[Unit]
After=network-online.target
#+END_SRC
2017-07-08 13:37:35 +02:00
*** files
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a784d230-8455-4414-a01c-fbc4acea82bc
:END:
2017-06-21 12:46:51 +02:00
**** remote.conf
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: f0242473-e2e9-4c77-8f31-12ae39c5d1a9
:END:
2017-07-08 13:37:35 +02:00
#+BEGIN_SRC conf :tangle roles/vdr/files/remote.conf :mkdirp yes :padline no
2017-06-21 12:46:51 +02:00
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
2017-07-08 13:37:35 +02:00
#+END_SRC
**** keymacros.conf
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 376f7ba3-d58e-4a5f-a811-d6f82d070587
:END:
2017-07-08 13:37:35 +02:00
#+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
2017-02-20 14:29:15 +01:00
#+END_SRC
2017-02-28 17:40:04 +01:00
** STARTED yavdr-network
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 5cae8669-27f7-4fd5-844c-8b16daa4daf4
:END:
2017-02-22 15:27:48 +01:00
*** default variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e1c8c821-b1eb-4ee3-91fc-ff67286bc0ac
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-network/main.yml :mkdirp yes :padline no
2017-02-22 15:27:48 +01:00
install_avahi: true
#+END_SRC
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 5a724dd4-6f39-4a42-a7d9-f2a69c3cfca1
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-network/tasks/main.yml :mkdirp yes :padline no
2017-02-22 15:27:48 +01:00
---
# this playbook sets up network services for a yaVDR installation
2017-06-20 15:09:15 +02:00
2017-12-17 14:37:03 +01:00
- name: apt | install packages for network services
2017-02-22 15:27:48 +01:00
apt:
2018-10-05 17:49:39 +02:00
name:
- avahi-daemon
- avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation!
- ethtool
- nfs-common
- vdr-addon-avahi-linker
- wakeonlan
2017-02-22 15:27:48 +01:00
state: present
install_recommends: no
2017-02-23 13:15:04 +01:00
# Does this really work? We need a way to check if an interface supports WOL - Python Skript?
# - name: check WOL capabilities of network interfaces
# shell: 'ethtool {{ item }} | grep -Po "(?<=Supports\sWake-on:\s).*$"'
# register: wol
# with_items: '{% for interface in ansible_interfaces if interface != 'lo' and interface != 'bond0' %}'
2018-01-24 11:12:03 +01:00
2017-07-08 13:37:35 +02:00
- name: restart autofs if running
2017-06-21 12:46:51 +02:00
systemd:
name: autofs
state: restarted
enabled: yes
masked: no
- name: ensure autofs is running
systemd:
name: autofs
state: started
enabled: yes
masked: no
2017-07-08 13:37:35 +02:00
- name: restart avahi-linker if running
systemd:
name: avahi-linker
state: restarted
enabled: yes
masked: no
2017-06-21 12:46:51 +02:00
- name: start avahi-linker
systemd:
name: avahi-linker
state: started
enabled: yes
masked: no
2017-07-16 08:29:13 +02:00
- name: enable and start additional services for avahi-linker
systemd:
name: '{{ item }}'
state: started
enabled: yes
masked: no
with_items:
- vdr-net-monitor
- vdr-update-monitor
- prevent-umount-on-pause
2017-02-23 13:15:04 +01:00
#+END_SRC
2017-06-22 13:28:10 +02:00
2019-01-05 11:42:07 +01:00
** vdr-plugin-menuorg
*** tasks
#+BEGIN_SRC yaml :tangle roles/vdr-plugin-menuorg/tasks/main.yml
---
# file: roles/vdr-plugin-menuorg/tasks/main.yml
- name: apt | install vdr-plugin-menuorg and yavdr-i18n
apt:
name:
- vdr-plugin-menuorg
- yavdr-i18n
state: present
install_recommends: no
- name: create /var/lib/vdr/plugins/menuorg.xml
template:
src: templates/menuorg.xml.j2
dest: /var/lib/vdr/plugins/menuorg.xml
#+END_SRC
*** templates
2019-01-05 11:43:59 +01:00
#+BEGIN_SRC jinja2 :tangle roles/vdr-plugin-menuorg/templates/menuorg.xml.j2
2019-01-05 11:42:07 +01:00
<?xml version="1.0" encoding="UTF-8"? >
{{ ansible_managed | comment('xml') }}
<!--
This is the config file for the Menuorg plug-in.
See /usr/share/doc/vdr-plugin-menurg for examples and a full
description of the config file format.
-->
<menus >
<system name="Schedule" / >
<system name="Channels" / >
<system name="Timers" / >
<system name="Recordings" / >
<plugin name="tvguide" / >
<plugin name="desktop" / >
<command name="Kodi" execute="frontend-dbus-send switchto kodi" / >
<menu name="{{ 'VDR Plugins' | translate }}" >
<plugin name="epgsearchonly" / >
<plugin name="quickepgsearch" / >
<plugin name="conflictcheckonly" / >
<plugin name="markad" / >
<plugin name="recsearch" / >
<plugin name="undelete" / >
<plugin name="radio" / >
<plugin name="osd2web" / >
</menu >
<menu name="{{ 'System' | translate }}" >
<menu name="Befehle" >
<command name="{{ "Safely remove usb mass storage" | translate }}" confirm="yes" execute="/usr/bin/vdr-mounter --unmount-all & > /dev/null" / >
<command name="{{ "Update vdr recordings list" | translate }}" execute="/usr/bin/vdr-dbus-send /Recordings recording.Update & > /dev/null " / >
<command name="{{ "Restart VDR" |translate }}" confirm="yes" execute="sudo /sbin/initctl restart vdr" / >
<command name="{{ "Reboot system"| translate }}" confirm="yes" execute="/usr/bin/at now -M -f /usr/bin/vdr-reboot" / >
<command name="{{ "Shutdown system" | translate }}" execute="/usr/bin/lircd2uinput-send KEY_POWER2 & > /dev/null & " / >
</menu >
<system name="Setup" / >
<plugin name="femon" / >
<plugin name="devstatus" / >
<plugin name="epg2vdr" / >
<plugin name="scraper2vdr" / >
<plugin name="sndctl" / >
<plugin name="suspendoutput" / >
<plugin name="recstatus" / >
<plugin name="dynamite" / >
<plugin name="noepgmenu" / >
<plugin name="systeminfo" / >
<plugin name="filebrowser" / >
<plugin name="pin" / >
<plugin name="pulsecontrol" / >
<plugin name="softhddevice" / >
</menu >
<system name="Commands" / >
</menus >
#+END_SRC
2017-06-20 15:09:15 +02:00
** nfs-server
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: dc47cc3a-6f18-4c8f-8d07-845f18015ee7
:END:
2017-07-08 13:37:35 +02:00
*** TODO avahi-services für NFS beim Stoppen des nfs-kernel-servers depublizieren, beim Start wieder announcen
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 3b548bca-9c10-41f8-bd0f-71fb4b8d76dc
:END:
2017-02-23 13:15:04 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c64ee510-ab40-4f99-9429-d8cdbc96268b
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes :padline no
---
2017-06-20 15:09:15 +02:00
- name: install nfs server packages
2017-02-22 15:27:48 +01:00
apt:
2018-10-05 17:49:39 +02:00
name:
- nfs-kernel-server
- nfs-common
2017-06-20 15:09:15 +02:00
state: present
install_recommends: no
- name: create /etc/exports
template:
src: templates/nfs-exports.j2
dest: /etc/exports
notify: [ 'Restart NFS Kernel Server' ]
2017-06-22 12:09:49 +02:00
2017-06-22 13:28:10 +02:00
- name: populate /etc/avahi/services
template:
src: templates/avahi/service.j2
dest: '/etc/avahi/services/yavdr-{{ item.key }}.service'
with_dict: '{{ media_dirs }}'
2017-06-20 15:09:15 +02:00
#+END_SRC
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 824677ea-d908-49ea-90c3-26d0173df138
:END:
2017-06-22 12:09:49 +02:00
**** /etc/exports
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: bd679410-847e-45cf-817c-7977436e1826
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC conf :tangle roles/nfs-server/templates/nfs-exports.j2 :mkdirp yes :padline no
2017-06-22 12:09:49 +02:00
/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
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 6fc68020-23c2-4682-945a-396598c5b8e6
:END:
2017-06-22 13:28:10 +02:00
#+BEGIN_SRC xml :tangle roles/nfs-server/templates/avahi/service.j2 :mkdirp yes :padline no
2017-06-22 12:09:49 +02:00
<?xml version="1.0" standalone='no'? >
<!DOCTYPE service-group SYSTEM "avahi-service.dtd" >
<service-group >
2017-06-22 13:28:10 +02:00
<name replace-wildcards="yes" >{{ item.key|capitalize }} on %h</name > ## Name
2017-06-22 12:09:49 +02:00
<service >
<type >_nfs._tcp</type >
<port >2049</port >
2017-06-22 13:28:10 +02:00
<txt-record >path={{ item.value }}</txt-record > ## path to shared Folder
<txt-record >subtype={{ 'vdr' if item.key = = 'recordings' else item.key }}</txt-record > ## subtype
2017-06-22 12:09:49 +02:00
</service >
</service-group >
2017-02-22 15:27:48 +01:00
#+END_SRC
2018-08-05 13:57:19 +02:00
2017-07-16 09:58:23 +02:00
** STARTED yavdr-remote
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: b36bb1c3-31df-4516-98a8-3887dfa911ec
:END:
2018-09-29 16:38:00 +02:00
The role ~yavdr-remote~ sets up the foundation for using eventlircd, lircd2uinput and the pre-configuration for remote receivers which can be detected by udev.
2017-02-22 15:27:48 +01:00
*** default variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 1a04ff42-42b5-4ab2-9edd-0d0bfaa1c8bb
:END:
2018-01-01 22:39:10 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-remote/defaults/main.yml :mkdirp yes :padline no
lircd0_socket: /var/run/lirc/lircd0
#+END_SRC
2017-02-22 15:27:48 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 37697c78-5ad9-4557-b42a-adc344b419fa
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-remote/tasks/main.yml :mkdirp yes :padline no
2017-06-20 16:20:24 +02:00
---
# This role is used to set up the yaVDR remote control configuration.
2018-01-01 22:39:10 +01:00
- name: apt | install packages for remote support
2017-07-15 14:28:23 +02:00
apt:
2018-10-05 17:49:39 +02:00
name:
- yavdr-remote
- lirc
2017-07-15 14:28:23 +02:00
state: present
2018-01-01 22:39:10 +01:00
tags:
- packages
2017-07-15 14:28:23 +02:00
2018-01-01 22:39:10 +01:00
- name: add systemd drop-in for lircd to use lircd2uinput
block:
- name: create directory /etc/systemd/system/lircd.service.d/
file:
path: /etc/systemd/system/lircd.service.d/
state: directory
- name: expand template for /etc/systemd/system/lircd.service.d/lircd2uinput.conf
template:
src: templates/lircd.service.d/lircd2uinput.conf.j2
dest: /etc/systemd/system/lircd.service.d/lircd2uinput.conf
tags:
- config
2017-06-20 16:20:24 +02:00
2018-01-18 09:35:32 +01:00
- name: stop, mask and disable lircd.socket, lircd.service, lircmd.service and lircd-uinput.service # (the default lirc configuration conflicts with eventlircd)
2017-07-08 13:37:35 +02:00
systemd:
name: '{{ item }}'
enabled: no
state: stopped
masked: yes
with_items:
- lircd.service
- lircd.socket
2018-01-18 09:35:32 +01:00
- lircmd.service
2017-07-16 10:17:08 +02:00
- lircd-uinput.service
2017-07-08 13:37:35 +02:00
ignore_errors: yes
2018-01-01 22:39:10 +01:00
tags:
- systemd
2017-07-08 13:37:35 +02:00
2018-05-06 19:26:04 +02:00
- name: apt | install eventlircd and lircd2uinput
2018-05-06 16:32:39 +02:00
apt:
2018-10-05 17:49:39 +02:00
name:
- eventlircd
- lircd2uinput
2018-05-06 16:32:39 +02:00
state: present
tags:
- packages
2017-07-16 09:17:39 +02:00
- name: configure vdr to read from a lircd-compatible socket
template:
src: templates/03-vdr-lirc.conf.j2
dest: /etc/vdr/conf.d/03-vdr-lirc.conf
2017-07-16 09:21:35 +02:00
notify: ['Restart VDR']
2018-01-01 22:39:10 +01:00
tags:
- config
2017-07-16 09:17:39 +02:00
2017-12-19 12:32:37 +01:00
- name: expand template for /etc/rc_maps.cfg
template:
src: templates/rc_maps.cfg.j2
dest: /etc/rc_maps.cfg
notify: ['Trigger Udev']
2018-01-01 22:39:10 +01:00
tags:
- config
2017-06-20 16:20:24 +02:00
#+END_SRC
2017-02-22 15:27:48 +01:00
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 63c9e331-4c32-4fca-9138-b8515071e996
:END:
2017-12-19 12:32:37 +01:00
**** Systemd Drop-in to start vdr with lirc support
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: fbd69a95-17a2-4e25-a04c-a5ddb89dbe08
:END:
2017-07-16 09:34:03 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-remote/templates/03-vdr-lirc.conf.j2 :mkdirp yes :padline no
2017-07-16 09:27:04 +02:00
{% if frontend != 'kodi' %}
2017-07-16 09:17:39 +02:00
[vdr]
--lirc=/var/run/lirc/lircd
2017-07-16 09:27:04 +02:00
{% endif %}
2017-07-16 09:17:39 +02:00
#+END_SRC
2018-01-01 22:39:10 +01:00
**** Systemd Drop-in to start lircd2uinput with lircd
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 513cef8c-ad4f-458b-84be-e16cdb55132c
:END:
2018-01-01 22:39:10 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-remote/templates/lircd.service.d/lircd2uinput.conf.j2 :mkdirp yes :padline no
[Service]
2018-01-01 23:41:03 +01:00
ExecStartPost=/usr/bin/lircd2uinput-add /var/run/lirc/lircd0
2018-01-01 23:27:47 +01:00
ExecStopPost=/usr/bin/lircd2uinput-remove /var/run/lirc/lircd0
2018-01-01 22:39:10 +01:00
#+END_SRC
2017-12-19 12:32:37 +01:00
**** create /etc/rc_maps.cfg
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: ce211e33-f7ed-445b-a730-b063b8974c52
:END:
2017-12-19 12:32:37 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-remote/templates/rc_maps.cfg.j2 :mkdirp yes :padline no
2018-08-02 10:04:27 +02:00
{{ ansible_managed | comment }}
2017-12-19 12:32:37 +01:00
#
# Keymaps table
#
# This table creates an association between a keycode file and a kernel
# driver. It can be used to automatically override a keycode definition.
#
# Although not yet tested, it is mented to be added at udev.
#
# To use, you just need to run:
# ./ir-keytable -a
#
# Or, if the remote is not the first device:
# ./ir-keytable -a -s rc1 # for RC at rc1
#
# Format:
# driver - name of the driver provided via uevent - use * for any driver
# table - RC keymap table, provided via uevent - use * for any table
# file - file name. If directory is not specified, it will default to
# /etc/rc_keymaps.
# For example:
# driver table file
# cx8800 * ./keycodes/rc5_hauppauge_new
# * rc-avermedia-m135a-rm-jx ./keycodes/kworld_315u
# saa7134 rc-avermedia-m135a-rm-jx ./keycodes/keycodes/nec_terratec_cinergy_xs
# em28xx * ./keycodes/kworld_315u
# * * ./keycodes/rc5_hauppauge_new
# Table to automatically load the rc maps for the bundled IR's provided with the
# devices supported by the linux kernel
#driver table file
2019-01-02 21:27:55 +01:00
ite-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
nuvoton-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
serial_ir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
mceusb rc-rc6-mce /lib/udev/rc_keymaps/HOPLOrc6
2019-01-02 21:17:21 +01:00
# Hauppauge PVR 350
ir-kbd-i2c rc-hauppauge /lib/udev/rc_keymaps/rc-hauppauge
# imon-pad
imon rc-imon-mce /lib/udev/rc_keymaps/rc-imon-mce
2019-01-02 21:27:55 +01:00
imon rc-imon-pad /lib/udev/rc_keymaps/rc-imon-pad
2019-01-02 21:17:21 +01:00
# TT-1500/1501
budget_ci rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1501
# Skystarhd2
mantis_core * /lib/udev/rc_keymaps/skystarhd2
# Medion X10
ati_remote rc-medion-x10 /lib/udev/rc_keymaps/rc-medion-x10
ati_remote rc-medion-x10-or2x /lib/udev/rc_keymaps/rc-medion-x10-or2x
ati_remote rc-medion-x10-digitainer /lib/udev/rc_keymaps/rc-medion-x10-digitainer
2019-01-02 21:27:55 +01:00
# other devices (which still mostly need a customized keymap for yaVDR)
2017-12-19 12:32:37 +01:00
,* rc-adstech-dvb-t-pci adstech_dvb_t_pci
,* rc-alink-dtu-m alink_dtu_m
,* rc-anysee anysee
,* rc-apac-viewcomp apac_viewcomp
,* rc-asus-pc39 asus_pc39
,* rc-asus-ps3-100 asus_ps3_100
,* rc-ati-tv-wonder-hd-600 ati_tv_wonder_hd_600
,* rc-ati-x10 ati_x10
,* rc-avermedia-a16d avermedia_a16d
,* rc-avermedia-cardbus avermedia_cardbus
,* rc-avermedia-dvbt avermedia_dvbt
,* rc-avermedia-m135a avermedia_m135a
,* rc-avermedia-m733a-rm-k6 avermedia_m733a_rm_k6
,* rc-avermedia-rm-ks avermedia_rm_ks
,* rc-avermedia avermedia
,* rc-avertv-303 avertv_303
,* rc-azurewave-ad-tu700 azurewave_ad_tu700
,* rc-behold-columbus behold_columbus
,* rc-behold behold
,* rc-budget-ci-old budget_ci_old
,* rc-cec cec
,* rc-cinergy-1400 cinergy_1400
,* rc-cinergy cinergy
,* rc-delock-61959 delock_61959
,* rc-dib0700-nec dib0700_nec
,* rc-dib0700-rc5 dib0700_rc5
,* rc-digitalnow-tinytwin digitalnow_tinytwin
,* rc-digittrade digittrade
,* rc-dm1105-nec dm1105_nec
,* rc-dntv-live-dvb-t dntv_live_dvb_t
,* rc-dntv-live-dvbt-pro dntv_live_dvbt_pro
,* rc-dtt200u dtt200u
,* rc-dvbsky dvbsky
,* rc-em-terratec em_terratec
,* rc-encore-enltv-fm53 encore_enltv_fm53
,* rc-encore-enltv encore_enltv
,* rc-encore-enltv2 encore_enltv2
,* rc-evga-indtube evga_indtube
,* rc-eztv eztv
,* rc-flydvb flydvb
,* rc-flyvideo flyvideo
,* rc-fusionhdtv-mce fusionhdtv_mce
,* rc-gadmei-rm008z gadmei_rm008z
,* rc-genius-tvgo-a11mce genius_tvgo_a11mce
,* rc-gotview7135 gotview7135
2019-01-02 21:27:55 +01:00
,* rc-hauppauge /lib/udev/rc_keymaps/rc-hauppauge
,* rc-imon-mce /lib/udev/rc_keymaps/rc-imon-mce
,* rc-imon-pad /lib/udev/rc_keymaps/rc-imon-pad
2017-12-19 12:32:37 +01:00
,* rc-iodata-bctv7e iodata_bctv7e
,* rc-it913x-v1 it913x_v1
,* rc-it913x-v2 it913x_v2
,* rc-kaiomy kaiomy
,* rc-kworld-315u kworld_315u
,* rc-kworld-pc150u kworld_pc150u
,* rc-kworld-plus-tv-analog kworld_plus_tv_analog
,* rc-leadtek-y04g0051 leadtek_y04g0051
,* rc-lme2510 lme2510
,* rc-manli manli
2019-01-02 21:17:21 +01:00
#* rc-medion-x10-digitainer medion_x10_digitainer
#* rc-medion-x10-or2x medion_x10_or2x
#* rc-medion-x10 medion_x10
2017-12-19 12:32:37 +01:00
,* rc-msi-digivox-ii msi_digivox_ii
,* rc-msi-digivox-iii msi_digivox_iii
,* rc-msi-tvanywhere-plus msi_tvanywhere_plus
,* rc-msi-tvanywhere msi_tvanywhere
,* rc-nebula nebula
,* rc-nec-terratec-cinergy-xs nec_terratec_cinergy_xs
,* rc-norwood norwood
,* rc-npgtech npgtech
,* rc-pctv-sedna pctv_sedna
,* rc-pinnacle-color pinnacle_color
,* rc-pinnacle-grey pinnacle_grey
,* rc-pinnacle-pctv-hd pinnacle_pctv_hd
,* rc-pixelview-002t pixelview_002t
,* rc-pixelview-mk12 pixelview_mk12
,* rc-pixelview-new pixelview_new
,* rc-pixelview pixelview
,* rc-powercolor-real-angel powercolor_real_angel
,* rc-proteus-2309 proteus_2309
,* rc-purpletv purpletv
,* rc-pv951 pv951
2019-01-02 21:27:55 +01:00
,* rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
2017-12-19 12:32:37 +01:00
,* rc-real-audio-220-32-keys real_audio_220_32_keys
,* rc-reddo reddo
,* rc-snapstream-firefly snapstream_firefly
,* rc-streamzap streamzap
,* rc-su3000 su3000
,* rc-tbs-nec tbs_nec
,* rc-technisat-ts35 technisat_ts35
,* rc-technisat-usb2 technisat_usb2
,* rc-terratec-cinergy-c-pci terratec_cinergy_c_pci
,* rc-terratec-cinergy-s2-hd terratec_cinergy_s2_hd
,* rc-terratec-cinergy-xs terratec_cinergy_xs
,* rc-terratec-slim-2 terratec_slim_2
,* rc-terratec-slim terratec_slim
,* rc-tevii-nec tevii_nec
,* rc-tivo tivo
,* rc-total-media-in-hand-02 total_media_in_hand_02
,* rc-total-media-in-hand total_media_in_hand
,* rc-trekstor trekstor
2019-01-02 21:27:55 +01:00
,* rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1500
2017-12-19 12:32:37 +01:00
,* rc-twinhan-dtv-cab-ci twinhan_dtv_cab_ci
,* rc-twinhan1027 twinhan_vp1027_dvbs
,* rc-videomate-k100 videomate_k100
,* rc-videomate-s350 videomate_s350
,* rc-videomate-tv-pvr videomate_tv_pvr
,* rc-winfast-usbii-deluxe winfast_usbii_deluxe
,* rc-winfast winfast
# * * a800 # found in a800.c
# * * af9005 # found in af9005-remote.c
# * * cinergyt2 # found in cinergyT2-core.c
# * * dvico_mce # found in cxusb.c
# * * dvico_portable # found in cxusb.c
# * * d680_dmb # found in cxusb.c
# * * dibusb # found in dibusb-common.c
# * * digitv # found in digitv.c
# * * megasky # found in m920x.c
2019-01-04 14:17:13 +01:00
# * * tvwalkerir-kbd-i2c # found in m920x.c
2017-12-19 12:32:37 +01:00
# * * pinnacle310e # found in m920x.c
# * * haupp # found in nova-t-usb2.c
# * * opera1 # found in opera1.c
# * * vp702x # found in vp702x.c
# * * vp7045 # found in vp7045.c
#+END_SRC
2017-02-22 15:27:48 +01:00
*** files
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: bc431f9c-7497-4731-9112-d4a8366695e1
:END:
2017-04-10 13:24:40 +02:00
2017-06-22 12:10:23 +02:00
** pulseaudio
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: af6190ba-085f-44f4-96ad-31e33d318ce7
:END:
2017-06-22 12:10:23 +02:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 39d79be1-828b-4add-8d2a-3107c12ee57e
:END:
2017-06-22 12:10:23 +02:00
#+BEGIN_SRC yaml :tangle roles/pulseaudio/tasks/main.yml :mkdirp yes :padline no
---
2017-12-17 11:37:28 +01:00
- name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol
2017-06-22 13:28:10 +02:00
apt:
2018-10-05 17:49:39 +02:00
name:
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
2017-06-22 12:10:23 +02:00
state: present
install_recommends: no
2017-07-15 14:28:23 +02:00
- name: create /etc/asound.conf with pulseaudio as default device
2017-06-22 12:10:23 +02:00
template:
src: templates/alsa/asound.conf.j2
dest: /etc/asound.conf
#+END_SRC
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 18320c8b-9382-4622-9ace-c922141a4f7b
:END:
2017-06-22 12:10:23 +02:00
#+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
2018-08-05 13:57:19 +02:00
2017-04-10 13:24:40 +02:00
** yavdr-xorg
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 6cccb613-6b37-4775-a53f-4c15992c6552
:END:
2017-08-01 10:40:53 +02:00
*** About the GUI session
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 3f614f9c-c24b-4450-82ff-5c3fe103e695
:END:
2018-04-24 09:56:29 +02:00
The X-Server is started by using the two systemd units ~xlogin@.service~ and ~x@.service~ provided by the package *xlogin* . The former is enabled (and started) for the vdr user - which results (using the default settings for the user *vdr* with the uid *666* ) in the activation of ~xlogin@vdr.service~ when reaching the graphical.target. To simplify starting and stopping the X-server and the desktop session a ~yavdr-xorg.service~ is provided by the package ~yavdr-xorg~ , which depends on the two units mentioned before.
2017-08-01 10:40:53 +02:00
2017-08-31 15:55:04 +02:00
~x@vt7.service~ is started automatically as a dependency of ~xlogin@vdr.service~ and starts the X-server. ~xlogin@vdr.service~ also starts a systemd user session using ~user@666.service~ .
2017-12-17 14:37:03 +01:00
In order to use the keyboard layout configured during installation for the X-Server the script ~write-x11-keyboard-config~ reads the keyboard configuration from ~/etc/default/keyboard~ when starting ~x@.service~ and writes the file ~/etc/X11/xorg.conf.d/00-keyboard.conf~ (because systemd for Ubuntu (and Debian) has been patched not to create ~/etc/X11/xorg.conf.d/00-keyboard.conf~ according to the ~localectl~ settings).
2017-08-01 10:40:53 +02:00
To prevent stopping the X-server when vdr is running, additional dependencies are set up - see the drop-in rules created in ~/etc/systemd/system/vdr.service.d/~ .
Basic Services like the session DBus, pulseaudio etc. are started for the ~default.target~ of the session.
The openbox autostart script is used to update the systemd session with the needed session variables. It creates a file =~/.session-env= which is used as an environment file by ~vdr.service~ (so the vdr knows the *DISPLAY* and can access pulseaudio).
The autostart script then enables all services to be pulled in by yavdr-desktop.target. As the last step ~yavdr-desktop.target~ is startet, which results in staring ~yavdr-frontend.service~ and additional Units for a second display (openbox and a browser for osd2eb, if available).
2017-08-31 15:55:04 +02:00
# TODO: describe yavdr-frontend
In order to achive a clean shutdown of the session, ~x@t7.service~ is set as a dependency of the systemd unit instance ~user@666.service~ and all processes within the session must be shutdown properly when stopping ~xlogin@vdr.service~ . If systemd units are used within the user session, they must stop their process(es) successfully (you should set them up to accept expected exit codes appropriately). The window manager /openbox/ is started using the =~/.xinitrc= and stopped using the systemd unit ~exit-wm.service~ (which runs on stopping the jobs pulled in by the ~default.target~ of the session).
*** TODO automatic X-server configuration :noexport:
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 8d3876e1-2cbb-4f82-9e8d-fe66dae2e1b2
:END:
2017-04-10 13:24:40 +02:00
- [X] detect connected display
- [X] read EDID from displays
2017-11-21 11:30:03 +01:00
create a xorg.conf for
- [X] nvidia
- [ ] intel
- [ ] amd gpus
2018-05-23 09:55:57 +02:00
- [ ] allow overscan compensation in xorg.conf or via xrandr on startup
2017-02-28 17:40:04 +01:00
2017-04-12 10:35:12 +02:00
**** HOLD Nvidia-GPUs:read EDID:
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a25ee66a-e37c-497e-ae0e-99d579785e6b
:END:
2017-04-10 13:24:40 +02:00
#+BEGIN_SRC shell
$ nvidia-xconfig --extract-edids-from-file=/var/log/Xorg.0.log --extract-edids-output-file= /tmp/edid.bin.0
Found 2 EDIDs in "/var/log/Xorg.0.log".
Wrote EDID for "DELL 2407WFP (CRT-1)" to "/tmp/edid.bin.0.0" (128 bytes).
Wrote EDID for "ADI A715 (DFP-1)" to "/tmp/edid.bin.0.1" (128 bytes).
$ xrandr -q
Screen 0: minimum 8 x 8, current 3200 x 1200, maximum 8192 x 8192
DVI-I-0 disconnected primary (normal left inverted right x axis y axis)
VGA-0 connected 1920x1200+1280+0 (normal left inverted right x axis y axis) 519mm x 324mm
1920x1200 59.95*+
1680x1050 59.95
1280x1024 75.02 60.02
1152x864 75.00
1024x768 75.03 60.00
800x600 75.00 60.32
640x480 75.00 59.94
DVI-I-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm
1280x1024 60.02*+
1024x768 60.00
800x600 60.32
640x480 59.95 59.94
$ parse-edid < /tmp/edid.bin.0.1
Checksum Correct
Section "Monitor"
Identifier "ADI A715"
ModelName "ADI A715"
VendorName "ADI"
# Monitor Manufactured week 15 of 2003
# EDID version 1.3
# Digital Display
DisplaySize 330 270
Gamma 2.20
Option "DPMS" "true"
#Not giving standard mode: 640x480, 60Hz
#Not giving standard mode: 800x600, 60Hz
#Not giving standard mode: 1024x768, 60Hz
#Not giving standard mode: 1280x1024, 60Hz
Modeline "Mode 0" 108.00 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
Modeline "Mode 1" 40.00 800 840 968 1056 600 601 605 628 +hsync +vsync
EndSection
$ parse-edid < /tmp/edid.bin.0.0
Checksum Correct
Section "Monitor"
Identifier "DELL 2407WFP"
ModelName "DELL 2407WFP"
VendorName "DEL"
# Monitor Manufactured week 24 of 2007
# EDID version 1.3
# Analog Display
Option "SyncOnGreen" "true"
DisplaySize 520 330
Gamma 2.20
Option "DPMS" "true"
Horizsync 30-83
VertRefresh 56-76
# Maximum pixel clock is 170MHz
#Not giving standard mode: 1280x1024, 60Hz
#Not giving standard mode: 1600x1200, 60Hz
#Not giving standard mode: 1152x864, 75Hz
#Not giving standard mode: 1680x1050, 60Hz
Modeline "Mode 0" 154.00 1920 1968 2000 2080 1200 1203 1209 1235 +hsync -vsync
EndSection
#+END_SRC
2017-11-09 09:52:00 +01:00
**** DONE Start X-server with debug-output :noexport:
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 92c5d2d8-6297-4991-94e7-9d9a018351cb
:END:
2017-04-10 13:24:40 +02:00
#+BEGIN_SRC conf
# /etc/systemd/system/x-debug@.service
2017-02-28 17:40:04 +01:00
[Unit]
2017-04-10 13:24:40 +02:00
Description=X with verbose logging on %I
Wants=graphical.target
Before=graphical.target
Conflicts=xlogin@vdr.service x@vt7.service
[Service]
Type=forking
ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I -config xdiscover.conf
2017-02-28 17:40:04 +01:00
#+END_SRC
2017-04-10 13:24:40 +02:00
#+BEGIN_SRC conf
# /etc/X11/xdiscover.conf
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
2017-02-28 17:40:04 +01:00
#+END_SRC
2017-04-10 13:24:40 +02:00
2017-04-12 10:35:12 +02:00
**** DONE python-script for parsing xrandr --verbose output
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 47bf38ed-69ef-48fc-80d6-3c73c5e97a50
:END:
2017-04-12 10:35:12 +02:00
***** Example output
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: d1837356-d6fe-4216-bde5-3202bf375a50
:END:
2017-04-10 13:24:40 +02:00
# ION-330-I
#+BEGIN_SRC shell :tangle library/xrandr_output.1
$ xrandr --verbose
Screen 0: minimum 8 x 8, current 1280 x 720, maximum 8192 x 8192
VGA-0 disconnected primary (normal left inverted right x axis y axis)
Identifier: 0x1c4
Timestamp: 18571
Subpixel: unknown
Clones:
CRTCs: 0 1
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
BorderDimensions: 4
supported: 4
Border: 0 0 0 0
range: (0, 65535)
SignalFormat: VGA
supported: VGA
ConnectorType: VGA
ConnectorNumber: 0
_ConnectorLocation: 1
HDMI-0 connected 1280x720+0+0 (0x1cb) normal (normal left inverted right x axis y axis) 885mm x 498mm
Identifier: 0x1c5
Timestamp: 18571
Subpixel: unknown
Gamma: 1.0:1.0:1.0
Brightness: 1.0
Clones:
CRTC: 0
CRTCs: 0 1fg
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
EDID:
00ffffffffffff004c2d800100000000
2c0e01038059328c0ae2bda15b4a9824
15474a20000001010101010101010101
010101010101011d007251d01e206e28
550075f23100001e011d00bc52d01e20
b828554075f23100001e000000fd0032
3d0f2e08000a202020202020000000fc
0053414d53554e470a20202020200181
02031971468413051403122309070783
01000065030c001000011d8018711c16
20582c250075f23100009e011d80d072
1c1620102c258075f23100009e8c0ad0
8a20e02d10103e960075f2310000188c
0ad090204031200c40550075f2310000
18000000000000000000000000000000
000000000000000000000000000000ca
BorderDimensions: 4
supported: 4
Border: 39 24 41 21
range: (0, 65535)
SignalFormat: TMDS
supported: TMDS
ConnectorType: HDMI
ConnectorNumber: 1
_ConnectorLocation: 2
1280x720 (0x1c6) 74.2MHz +HSync +VSync +preferred
h: width 1280 start 1390 end 1430 total 1650 skew 0 clock 45.0KHz
v: height 720 start 725 end 730 total 750 clock 60.0Hz
1920x1080 (0x1c7) 74.2MHz +HSync +VSync Interlace
h: width 1920 start 2008 e#nd 2052 total 2200 skew 0 clock 33.8KHz
v: height 1080 start 1084 end 1094 total 1124 clock 60.1Hz
1920x1080 (0x1c8) 74.2MHz +HSync +VSync Interlace
h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 33.7KHz
v: height 1080 start 1084 end 1094 total 1124 clock 60.0Hz
1920x1080 (0x1c9) 74.2MHz +HSync +VSync Interlace
h: width 1920 start 2448 end 2492 total 2640 skew 0 clock 28.1KHz
v: height 1080 start 1084 end 1094 total 1124 clock 50.0Hz
1280x720 (0x1ca) 74.2MHz +HSync +VSync
h: width 1280 start 1390 end 1430 total 1650 skew 0 clock 45.0KHz
v: height 720 start 725 end 730 total 750 clock 59.9Hz
1280x720 (0x1cb) 74.2MHz +HSync +VSync *current
h: width 1280 start 1720 end 1760 total 1980 skew 0 clock 37.5KHz
v: height 720 start 725 end 730 total 750 clock 50.0Hz
800x600 (0x1cc) 40.0MHz +HSync +VSync
h: width 800 start 840 end 968 total 1056 skew 0 clock 37.9KHz
v: height 600 start 601 end 605 total 628 clock 60.3Hz
800x600 (0x1cd) 36.0MHz +HSync +VSync
h: width 800 start 824 end 896 total 1024 skew 0 clock 35.2KHz
v: height 600 start 601 end 603 total 625 clock 56.2Hz
720x576 (0x1ce) 27.0MHz -HSync -VSync
h: width 720 start 732 end 796 total 864 skew 0 clock 31.2KHz
v: height 576 start 581 end 586 total 625 clock 50.0Hz
720x480 (0x1cf) 27.0MHz -HSync -VSync
h: width 720 start 736 end 798 total 858 skew 0 clock 31.5KHz
v: height 480 start 489 end 495 total 525 clock 59.9Hz
640x480 (0x1d0) 25.2MHz -HSync -VSync
h: width 640 start 656 end 752 total 800 skew 0 clock 31.5KHz
v: height 480 start 490 end 492 total 525 clock 59.9Hz
320x240 (0x1d1) 12.6MHz -HSync -VSync DoubleScan
h: width 320 start 328 end 376 total 400 skew 0 clock 31.5KHz
v: height 240 start 245 end 246 total 262 clock 60.1Hz
#+END_SRC
# GT210
#+BEGIN_SRC shell :tangle library/xrandr_output.2
$ xrandr --verbose
Screen 0: minimum 8 x 8, current 3200 x 1200, maximum 8192 x 8192
DVI-I-0 disconnected primary (normal left inverted right x axis y axis)
Identifier: 0x1c4
Timestamp: 641679
Subpixel: unknown
Clones:
CRTCs: 0 1
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
BorderDimensions: 4
supported: 4
Border: 0 0 0 0
range: (0, 65535)
SignalFormat: VGA
supported: VGA
ConnectorType: DVI-I
ConnectorNumber: 0
_ConnectorLocation: 0
VGA-0 connected 1920x1200+1280+0 (0x1c6) normal (normal left inverted right x axis y axis) 519mm x 324mm
Identifier: 0x1c5
Timestamp: 641679
Subpixel: unknown
Gamma: 1.0:1.0:1.0
Brightness: 1.0
Clones:
CRTC: 1
CRTCs: 0 1
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
EDID:
00ffffffffffff0010ac16a0534b4431
181101030e342178eeee91a3544c9926
0f5054a54b008180a940714fb3000101
010101010101283c80a070b023403020
360007442100001a000000ff00555935
343537364531444b5320000000fc0044
454c4c20323430375746500a000000fd
00384c1e5311000a20202020202000f1
BorderDimensions: 4
supported: 4
Border: 0 0 0 0
range: (0, 65535)
SignalFormat: VGA
supported: VGA
ConnectorType: VGA
ConnectorNumber: 2
_ConnectorLocation: 2
1920x1200 (0x1c6) 154.000MHz +HSync -VSync *current +preferred
h: width 1920 start 1968 end 2000 total 2080 skew 0 clock 74.04KHz
v: height 1200 start 1203 end 1209 total 1235 clock 59.95Hz
1680x1050 (0x1c7) 146.250MHz -HSync +VSync
h: width 1680 start 1784 end 1960 total 2240 skew 0 clock 65.29KHz
v: height 1050 start 1053 end 1059 total 1089 clock 59.95Hz
1280x1024 (0x1c8) 135.000MHz +HSync +VSync
h: width 1280 start 1296 end 1440 total 1688 skew 0 clock 79.98KHz
v: height 1024 start 1025 end 1028 total 1066 clock 75.02Hz
1280x1024 (0x1c9) 108.000MHz +HSync +VSync
h: width 1280 start 1328 end 1440 total 1688 skew 0 clock 63.98KHz
v: height 1024 start 1025 end 1028 total 1066 clock 60.02Hz
1152x864 (0x1ca) 108.000MHz +HSync +VSync
h: width 1152 start 1216 end 1344 total 1600 skew 0 clock 67.50KHz
v: height 864 start 865 end 868 total 900 clock 75.00Hz
1024x768 (0x1cb) 78.750MHz +HSync +VSync
h: width 1024 start 1040 end 1136 total 1312 skew 0 clock 60.02KHz
v: height 768 start 769 end 772 total 800 clock 75.03Hz
1024x768 (0x1cc) 65.000MHz -HSync -VSync
h: width 1024 start 1048 end 1184 total 1344 skew 0 clock 48.36KHz
v: height 768 start 771 end 777 total 806 clock 60.00Hz
800x600 (0x1cd) 49.500MHz +HSync +VSync
h: width 800 start 816 end 896 total 1056 skew 0 clock 46.88KHz
v: height 600 start 601 end 604 total 625 clock 75.00Hz
800x600 (0x1ce) 40.000MHz +HSync +VSync
h: width 800 start 840 end 968 total 1056 skew 0 clock 37.88KHz
v: height 600 start 601 end 605 total 628 clock 60.32Hz
640x480 (0x1cf) 31.500MHz -HSync -VSync
h: width 640 start 656 end 720 total 840 skew 0 clock 37.50KHz
v: height 480 start 481 end 484 total 500 clock 75.00Hz
640x480 (0x1d0) 25.175MHz -HSync -VSync
h: width 640 start 656 end 752 total 800 skew 0 clock 31.47KHz
v: height 480 start 490 end 492 total 525 clock 59.94Hz
DVI-I-1 disconnected (normal left inverted right x axis y axis)
Identifier: 0x1d1
Timestamp: 641679
Subpixel: unknown
Clones:
CRTCs: 0 1
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
BorderDimensions: 4
supported: 4
Border: 0 0 0 0
range: (0, 65535)
SignalFormat: TMDS
supported: TMDS
ConnectorType: DVI-I
ConnectorNumber: 0
_ConnectorLocation: 0
HDMI-0 connected 1280x1024+0+0 (0x1c9) normal (normal left inverted right x axis y axis) 338mm x 270mm
Identifier: 0x1d2
Timestamp: 641679
Subpixel: unknown
Gamma: 1.0:1.0:1.0
Brightness: 1.0
Clones:
CRTC: 0
CRTCs: 0 1
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
EDID:
00ffffffffffff0004895d2320090000
0f0d0103e0211b782ac5c6a3574a9c23
124f5421080031404540614081800101
010101010101302a009851002a403070
1300520e1100001ea00f200031581c20
28801400520e1100001e000000ff0033
31355430324530323333360a000000fc
0041444920413731350a20202020002b
BorderDimensions: 4
supported: 4
Border: 0 0 0 0
range: (0, 65535)
SignalFormat: TMDS
supported: TMDS
ConnectorType: HDMI
ConnectorNumber: 1
_ConnectorLocation: 1
1280x1024 (0x1c9) 108.000MHz +HSync +VSync *current +preferred
h: width 1280 start 1328 end 1440 total 1688 skew 0 clock 63.98KHz
v: height 1024 start 1025 end 1028 total 1066 clock 60.02Hz
1024x768 (0x1cc) 65.000MHz -HSync -VSync
h: width 1024 start 1048 end 1184 total 1344 skew 0 clock 48.36KHz
v: height 768 start 771 end 777 total 806 clock 60.00Hz
800x600 (0x1ce) 40.000MHz +HSync +VSync
h: width 800 start 840 end 968 total 1056 skew 0 clock 37.88KHz
v: height 600 start 601 end 605 total 628 clock 60.32Hz
640x480 (0x1d3) 25.180MHz -HSync -VSync
h: width 640 start 648 end 744 total 800 skew 0 clock 31.48KHz
v: height 480 start 482 end 484 total 525 clock 59.95Hz
640x480 (0x1d0) 25.175MHz -HSync -VSync
h: width 640 start 656 end 752 total 800 skew 0 clock 31.47KHz
v: height 480 start 490 end 492 total 525 clock 59.94Hz
#+END_SRC
2017-04-12 10:35:12 +02:00
***** parse hex-strings
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 96a9168e-9acb-4c9b-bd12-df5f24a619e4
:END:
2017-04-10 13:24:40 +02:00
#+BEGIN_SRC python
>>> import binascii
>>> s = "deadbeef"
>>> binascii.a2b_hex(s)
b'\xde\xad\xbe\xef'
2017-02-28 17:40:04 +01:00
#+END_SRC
2017-02-22 15:27:48 +01:00
*** default variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c03c69a3-2576-4d14-a6bd-1b45e545676c
:END:
2018-01-07 18:45:01 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/defaults/main.yml :mkdirp yes :padline no
2018-01-07 19:00:27 +01:00
first_run: False
2018-05-10 22:04:45 +02:00
preferred_outputs:
- HDMI
- DP
- DVI
- VGA
- TV
preferred_resolutions:
- 7680x4320
- 3840x2160
- 1920x1080
- 1280x720
- 720x576
preferred_refreshrates:
- 50
- 60
2018-01-07 18:45:01 +01:00
#+END_SRC
2017-02-22 15:27:48 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 610376b7-9bd2-40ea-9672-1e097d6d72fa
:END:
2017-12-20 10:43:15 +01:00
**** main.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: cc8a3d2d-4676-45fa-a416-762c5c52cb4a
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/main.yml :mkdirp yes :padline no
2017-02-22 15:27:48 +01:00
---
# file: roles/yavdr-xorg/tasks/main.yml
2018-01-07 17:46:55 +01:00
- import_tasks: setup-xorg.yml
tags: [install,update]
- import_tasks: detect-xorg.yml
tags: [xorg.detect,install]
2017-07-30 14:29:38 +02:00
#+END_SRC
2017-12-20 10:43:15 +01:00
**** setup-xorg.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4719a732-4972-471d-b9d3-57e42ac15fdc
:END:
2017-07-30 14:29:38 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/setup-xorg.yml :mkdirp yes :padline no
2017-08-31 15:55:04 +02:00
---
# file: roles/yavdr-xorg/tasks/setup-xorg.yml
2017-07-31 10:38:02 +02:00
- name: create directories for systemd drop-in files
2017-06-22 13:28:10 +02:00
file:
2017-07-31 10:38:02 +02:00
dest: '{{ item }}'
2017-06-22 13:28:10 +02:00
state: directory
2017-07-31 10:38:02 +02:00
with_items:
2017-11-21 11:30:03 +01:00
- "/etc/systemd/system/x@.service.d/ "
- "/etc/systemd/system/vdr.service.d/ "
- "/etc/systemd/system/user@{{ vdr.uid }}.service.d/ "
2017-12-17 10:38:12 +01:00
- "/etc/X11/xorg.conf.d/ "
2017-11-22 08:11:56 +01:00
- name: systemd-drop-in | add dependency to X-server for vdr.service
2017-07-16 11:05:54 +02:00
template:
src: templates/vdr-xorg.conf
dest: /etc/systemd/system/vdr.service.d/vdr-xorg.conf
2018-01-27 20:45:31 +01:00
- name: systemd-drop-in | start x@.service after plymouth.service
template:
src: templates/x@service.d/plymouth.conf.j2
dest: /etc/systemd/system/x@.service.d/plymouth.conf
2017-11-22 08:11:56 +01:00
- name: systemd-drop-in | start x@.service before xlogin@.service
2017-07-31 10:38:02 +02:00
template:
src: templates/x@service.d/xlogin.conf.j2
dest: /etc/systemd/system/x@.service.d/xlogin.conf
2017-11-22 08:11:56 +01:00
- name: systemd-drop-in | load environment file for vdr.service
2017-06-22 13:28:10 +02:00
template:
src: templates/systemd/vdr-environ.j2
dest: /etc/systemd/system/vdr.service.d/load-environ.conf
2017-11-22 08:11:56 +01:00
- name: systemd-drop-in | user@{{ vdr.uid }}.service depends on x@vt7.service
2017-07-31 11:45:33 +02:00
template:
2017-07-31 12:11:28 +02:00
src: templates/user@666.service.d/x-dependency.conf.j2
2017-07-31 11:45:33 +02:00
dest: '/etc/systemd/system/user@{{ vdr.uid }}.service.d/x-dependency.conf'
2017-11-22 08:11:56 +01:00
- name: vdr-config | start softhddevice detached and set audio to pulseaudio
2017-07-31 08:22:05 +02:00
lineinfile:
path: /etc/vdr/conf.avail/softhddevice.conf
2017-12-17 11:31:53 +01:00
line: '{{ item }}'
2017-07-31 08:22:05 +02:00
with_items:
- '-D'
2018-02-23 16:00:41 +01:00
- '-w alsa-driver-broken'
2017-07-31 08:22:05 +02:00
# - '-a pulse' # do we need this with our existing asound.conf?
2017-11-21 11:30:03 +01:00
- name: add a login shell for the user vdr
2017-07-16 11:05:54 +02:00
user:
name: '{{ vdr.user }}'
shell: '/bin/bash'
state: present
uid: '{{ vdr.uid }}'
groups: '{{ vdr.group }}'
append: yes
2017-11-09 10:37:06 +01:00
- name: apt | install packages for xorg
2017-02-22 15:27:48 +01:00
apt:
2018-10-05 17:49:39 +02:00
name:
- xlogin
- yavdr-xorg
- xorg
- xserver-xorg-input-all
- xserver-xorg-video-all
- openbox
- python3-dbus2vdr
- python3-yavdrfrontend
- read-edid
- tmux
- vdr-plugin-desktop
- vdr-plugin-osd2web
- feh
#- yavdr-xorg
2017-02-22 15:27:48 +01:00
state: present
2017-11-09 10:37:06 +01:00
2018-04-20 15:26:52 +02:00
- name: apt | install packages for Intel IGP
2018-04-20 11:10:11 +02:00
apt:
2018-10-05 17:49:39 +02:00
name:
- xserver-xorg-video-intel
- i965-va-driver-shaders
2018-04-20 11:10:11 +02:00
state: present
when: intel_detected
2018-12-11 14:01:04 +01:00
- name: Install yaVDR Media (e.g. Backgrounds)
apt:
name: yavdr-media
2017-12-20 13:18:30 +01:00
2017-12-19 14:43:55 +01:00
- name: command | write keyboard configuration to /etc/X11/xorg.conf.d/00-keyboard.conf
command: write-x11-keyboard-config
2018-01-16 09:27:25 +01:00
args:
creates: /etc/X11/xorg.conf.d/00-keyboard.conf
2017-12-19 14:43:55 +01:00
# NOTE: write-x11-keyboard-config is in the xlogin package
# Ubuntu's systemd is patched, so it does not create the file automatically
2018-01-24 10:53:05 +01:00
- name: add snippet to ignore eventlircd devices in xorg
template:
src: templates/xorg-ignore-eventlircd.conf.j2
dest: /etc/X11/xorg.conf.d/40-ignore-eventlircd.conf
2017-11-09 10:37:06 +01:00
- name: apt | install desktop programs
apt:
2018-10-05 17:49:39 +02:00
name:
- xterm
- firefox
- kiosk-browser
2017-11-09 10:37:06 +01:00
state: present
2017-07-16 11:05:54 +02:00
#+END_SRC
2017-12-20 10:43:15 +01:00
**** detect-xorg.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 7fb28921-58b1-4c7d-867e-4ea301fd4c33
:END:
2017-07-16 11:05:54 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/detect-xorg.yml :mkdirp yes :padline no
---
# file: roles/yavdr-xorg/tasks/detect-xorg.yml
2017-04-10 13:24:40 +02:00
- name: "expand template for x-verbose@.service"
template:
2017-06-21 12:46:51 +02:00
src: "templates/systemd/system/x-verbose@.service.j2"
2017-04-10 13:24:40 +02:00
dest: "/etc/systemd/system/x-verbose@.service"
2017-07-08 13:37:35 +02:00
- name: "expand template for xorg-verbose.conf"
template:
src: "templates/xorg-verbose.conf.j2"
dest: "/etc/X11/xorg-verbose.conf"
2017-07-30 14:29:38 +02:00
- name: Stop VDR
systemd:
name: vdr.service
state: stopped
enabled: yes
notify: ['Start VDR']
2018-04-24 09:56:29 +02:00
- name: Stop yavdr-xorg
systemd:
name: 'yavdr-xorg'
state: stopped
enabled: yes
notify: ['Start yavdr-xorg']
2017-07-30 14:29:38 +02:00
- name: Stop xlogin
systemd:
2017-07-30 23:28:13 +02:00
name: 'xlogin@{{ vdr.user }}.service'
2017-07-30 14:29:38 +02:00
state: stopped
2018-01-07 17:58:33 +01:00
notify: ['Start xlogin']
2017-07-30 14:29:38 +02:00
- name: Stop x
systemd:
name: x@vt7.service
state: stopped
2018-01-07 17:40:29 +01:00
- name: Workaround for wrong connector names on first run
block:
- name: "wait a little bit before starting x-verbose@vt7.service (needed?)"
wait_for:
timeout: 10
- name: "start x-verbose@.service"
systemd:
name: "x-verbose@vt7.service"
state: started
enabled: false
masked: false
daemon_reload: true
- name: "wait a little bit, so X has some time to start up (needed?)"
wait_for:
timeout: 3
- name: "stop x-verbose@vt7.service"
systemd:
name: "x-verbose@vt7.service"
state: stopped
enabled: false
masked: true
2018-01-07 18:45:01 +01:00
when: first_run
2017-04-10 13:24:40 +02:00
2018-01-07 12:56:46 +01:00
- name: "wait a little bit, so X has some time to shut down (needed?)"
wait_for:
timeout: 3
- name: "trigger udevadm reload"
command: 'udevadm trigger '
- name: "wait a little bit, so udev has some time to reapply rules (needed?)"
2017-04-10 13:24:40 +02:00
wait_for:
timeout: 3
2018-01-07 12:56:46 +01:00
- name: "start x-verbose@.service"
2018-01-07 14:53:19 +01:00
systemd:
name: "x-verbose@vt7.service"
state: started
enabled: false
masked: false
daemon_reload: true
2018-01-07 12:56:46 +01:00
- name: "wait a little bit, so X has some time to start up (needed?)"
2018-01-07 14:53:19 +01:00
wait_for:
timeout: 3
2018-01-07 12:56:46 +01:00
2017-04-10 13:24:40 +02:00
- name: "detect xorg configuration"
2018-05-10 22:04:45 +02:00
xrandr_facts:
preferred_refreshrates: '{{ preferred_refreshrates }}'
preferred_resolutions: '{{ preferred_resolutions }}'
preferred_outputs: '{{ preferred_outputs }}'
2017-04-10 13:24:40 +02:00
2017-07-08 13:37:35 +02:00
- debug:
var: xorg.primary
- debug:
var: xorg.secondary
when: xorg.secondary is defined
2017-04-10 13:24:40 +02:00
- name: "stop x-verbose@vt7.service"
systemd:
name: "x-verbose@vt7.service"
state: stopped
enabled: false
masked: true
2017-07-30 14:29:38 +02:00
2017-11-21 11:30:03 +01:00
- name: "wait a little bit, so X has some time to shut down (needed?)"
wait_for:
timeout: 3
2018-01-16 14:56:51 +01:00
- name: save results
block:
2018-01-16 15:01:27 +01:00
- name: ensure facts.d directory exists
file:
state: directory
path: /etc/ansible/facts.d
2018-01-19 07:51:38 +01:00
- name: write xorg variable as local fact
2018-01-16 15:02:13 +01:00
copy:
2018-01-19 07:51:38 +01:00
content: '{{ {"xorg": xorg} | to_nice_json }}'
2018-01-16 15:02:13 +01:00
dest: /etc/ansible/facts.d/xorg.fact
2018-01-19 07:51:38 +01:00
- name: write xrandr variable as local fact
copy:
content: '{{ {"xrandr": xrandr} | to_nice_json }}'
dest: /etc/ansible/facts.d/xrandr.fact
2018-01-16 14:56:51 +01:00
when:
- xrandr is defined
- xorg is defined
- name: update xorg and xrandr variable with values from local facts if needed
set_fact:
2019-01-04 14:17:13 +01:00
xorg: '{{ ansible_local.xorg.xorg }}'
xrandr: '{{ ansible_local.xrandr.xrandr }}'
2018-01-16 14:56:51 +01:00
when:
- xrandr is undefined
- xorg is undefined
2017-07-30 14:29:38 +02:00
# TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver
# nvidia, noveau, intel, radeon
2017-08-31 15:55:04 +02:00
2017-11-21 11:30:03 +01:00
- name: nvidia related config
block:
- name: create xorg.conf (for nvidia driver)
template:
src: templates/xorg.conf.j2
dest: /etc/X11/xorg.conf
backup: yes
when:
- nvidia_detected
2017-07-16 11:05:54 +02:00
#+END_SRC
2018-06-06 07:51:07 +02:00
**** intel.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0b27229f-3cb1-4b30-bd91-b173c40e7d0c
:END:
2018-06-08 19:54:17 +02:00
KMS drivers (like for intel (i915) and amd (radeon)) require additional configuration beneath a customized ~xorg.conf~ - for a "static" output configuration (which works if the TV or AV receiver is not turned on) we need to force loading the display(s) EDID early during the boot process.
This task therefore performs the following actions after the xrandr detection has been executed:
- create an initramfs-hook to copy the EDID(s) into the initramfs
- get the connector names and match them to the ones determined by xrandr
- add kernel boot arguments to set EDID and mode (refreshrate and resolution) for all outputs
- recreate and update initramfs and grub config
Please note that rescanning the connected displays works only after removing the forced loading of EDID(s) during boot (call ~clean-edids~ ) and a reboot.
2018-06-06 07:51:07 +02:00
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/intel.yml :mkdirp yes :padline no
- name: "create initramfs hook to copy EDID files"
copy:
src: files/include-edid-data.sh
dest: '/etc/initramfs-tools/hooks/include-edid-data'
mode: 0755
force: yes
2018-06-08 19:54:17 +02:00
- name: "create /lib/firmware/edid"
file:
state: directory
dest: /lib/firmware/edid
2018-06-06 07:51:07 +02:00
# TODO:
2018-06-08 19:54:17 +02:00
# - write EDID files to /lib/firmware/edid/
# - complete template for grub.d
name: "add kernel boot parameters for static display configuration"
template:
src: templates/grub.d/intel.j2
dest: /etc/grub.d/99_intel
mode: 0755
2018-06-06 07:51:07 +02:00
notify: ['Update Initramfs', 'Update GRUB']
2018-06-08 19:54:17 +02:00
2018-06-06 07:51:07 +02:00
#+END_SRC
2017-03-26 13:57:31 +02:00
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9fe4445a-f8f7-42d4-81ba-f697260e2844
:END:
2018-06-08 19:54:17 +02:00
**** grub
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: eb4e27ae-937f-4893-91c2-cf3d731536db
:END:
2018-06-08 19:54:17 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/grub.d/intel.j2 :mkdirp yes :padline no
{% set output_flag = 'D' if ("HDMI" in xorg.primary.connector or "DVI" in xorg.primary.connector or "DP" in xorg.primary.connector) else 'e' %}
GRUB_CMDLINE_LINUX+=" video= {{ xorg.primary.drm_connector }}:{{ xorg.primary.mode|replace('_ ', '@') }}{{ output_flag }} drm.edid_firmware={{ xorg.primary.drm_connector }}:edid/edid.bin"
2019-01-05 11:42:26 +01:00
# TODO: configure additional monitors (primary monitor on, all others off)
2018-06-08 19:54:17 +02:00
#+END_SRC
2017-06-20 16:20:24 +02:00
**** xorg
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: fc981225-073c-42d0-a23a-f0d770883ee4
:END:
2017-06-21 12:46:51 +02:00
***** x-verbose@.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 76b4fe80-7c7f-45b0-b691-4a0f127ca159
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC conf :tangle "roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2" :padline no
2017-08-31 15:55:04 +02:00
# file: roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2
2017-03-26 13:57:31 +02:00
[Unit]
Description=X with verbose logging on %I
Wants=graphical.target
Before=graphical.target
[Service]
Type=forking
2017-11-09 08:36:17 +01:00
ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I -config /etc/X11/xorg-verbose.conf
2017-03-26 13:57:31 +02:00
#+END_SRC
2017-07-31 10:38:02 +02:00
***** Drop-in snippet for x@.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4373becf-733f-4c0d-a830-17af99395eb6
:END:
2018-01-27 20:45:31 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/x@service.d/plymouth.conf.j2 :mkdirp yes :padline no
[Unit]
After=plymouth.service
#+END_SRC
2017-07-31 10:38:02 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/x@service.d/xlogin.conf.j2 :mkdirp yes :padline no
[Unit]
2017-09-12 09:26:43 +02:00
Before=xlogin@{{ vdr.user }}.service
2017-07-31 10:38:02 +02:00
#+END_SRC
2017-07-31 11:45:33 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/user@666.service.d/x-dependency.conf.j2 :mkdirp yes :padline no
[Unit]
Wants=x@vt7.service
After=x@vt7.service
[Service]
TimeoutStopSec=20
KillMode=mixed
#+END_SRC
2017-06-21 12:46:51 +02:00
***** Drop-in snippet for vdr.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 44d62722-3e6b-4180-9e38-8936b4470112
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/vdr-xorg.conf :mkdirp yes :padline no
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2017-04-10 13:24:40 +02:00
[Unit]
After=x@vt7.service
Wants=x@vt7.service
2017-06-20 15:09:15 +02:00
#BindsTo=x@vt7.service
2017-04-10 13:24:40 +02:00
#+END_SRC
2018-01-24 10:53:05 +01:00
***** xorg.conf snippets
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 6da4a70b-96c0-4635-9b82-c89fc45a39c5
:END:
2018-01-24 10:53:05 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/xorg-ignore-eventlircd.conf.j2
{{ ansible_managed | comment }}
Section "InputClass"
Identifier "exclude eventlircd devices"
MatchTag "eventlircd"
Option "Ignore" "True"
EndSection
#+END_SRC
2019-01-04 14:26:46 +01:00
***** intel graphics xorg.conf snippet
#+BEGIN_SRC jinja2 :tangle roles/yavdr-xorg/templates/20-intel.conf.j2
{{ ansible_managed | comment }}
{% set output = xorg.primary.connector|replace("-", "") %}
Section "Device"
Identifier "Device0"
Driver "intel"
Option "TearFree" "true"
Option "UseEDID" "true"
Option "CustomEDID" "{{ output }}:/lib/firmware/edid/edid.{{ xorg.primary.connector }}.bin"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "{{ output }}"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080_50" "1920x1080_60" "1920x1080_24"
EndSubSection
EndSection
Section "Monitor"
Identifier "{{ output }}"
Modeline "1920x1080_24" 74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_50" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_60" 148.500 1920 2008 2056 2200 1080 1084 1089 1125 +hsync +vsync
EndSection
{% for connector, data in xrandr["Screen 0"].iteritems() %}
{% if not data.is_connected %}
Section "Monitor"
Identifier "{{ connector|replace("-","") }}"
Option "Ignore" "true"
EndSection
{% endif %}
{% endfor %}
#+END_SRC
2017-07-08 13:37:35 +02:00
***** xorg.conf
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: d7064700-5a05-478a-a20d-10a5fe472661
:END:
2017-07-08 13:37:35 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/xorg-verbose.conf.j2
2019-01-04 14:26:46 +01:00
{{ ansible_managed | comment }}
2017-07-08 13:37:35 +02:00
Section "Device"
Identifier "nvidia"
Driver "nvidia"
Option "DynamicTwinView" "true"
Option "NoFlip" "false"
EndSection
2017-04-10 13:24:40 +02:00
2017-07-08 13:37:35 +02:00
Section "Screen"
Identifier "screen"
Device "nvidia"
EndSection
2017-05-12 18:21:26 +02:00
#+END_SRC
2017-07-08 13:37:35 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/xorg.conf.j2
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2017-05-12 18:21:26 +02:00
2017-07-08 13:37:35 +02:00
Section "ServerLayout"
Identifier "Layout0"
2017-07-16 09:58:23 +02:00
Screen 0 "Screen0" 0 0
2017-07-08 13:37:35 +02:00
{% if xorg.secondary is defined %}
Screen 1 "Screen1" RightOf "Screen0"
{% endif %}
#InputDevice "Keyboard0" "CoreKeyboard"
#InputDevice "Mouse0" "CorePointer"
2017-07-16 09:58:23 +02:00
Option "Xinerama" "0"
2017-07-08 13:37:35 +02:00
EndSection
2017-03-13 10:40:35 +01:00
2017-07-08 13:37:35 +02:00
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"
2017-07-16 09:58:23 +02:00
Option "NoLogo" "true"
2017-07-08 13:37:35 +02:00
{% if xorg.primary.bus_id is defined %}
BoardName "{{ xorg.primary.gpu_name }}"
BusID "{{ xorg.primary.bus_id }}"
{% else %}
BoardName "Unknown"
{% endif %}
Screen 0
2018-01-27 21:01:04 +01:00
Option "ConnectedMonitor" "{{ xorg.primary.connector }}{% if xorg.secondary is defined %}, {{ xorg.secondary.connector }}{% endif %}"
Option "CustomEDID" "{{ xorg.primary.connector }}:/etc/X11/edid.{{ xorg.primary.connector }}.bin{% if xorg.secondary is defined %};{{ xorg.secondary.connector }}:/etc/X11/edid.{{ xorg.secondary.connector }}.bin{% endif %}"
2017-07-08 13:37:35 +02:00
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "nvidiaXineramaInfoOrder" "{{ xorg.primary.connector }}"
Option "UseDisplayDevice" "{{ xorg.primary.connector }}"
2018-06-02 20:03:24 +02:00
Option "metamodes" "{{ xorg.primary.connector }}: {{ xorg.primary.mode }} +0+0 {ForceCompositionPipeline=Off, ForceFullCompositionPipeline=Off}"
2018-01-03 13:19:59 +01:00
Option "AllowIndirectGLXProtocol" "off"
Option "TripleBuffer" "on"
2017-07-08 13:37:35 +02:00
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 }}"
2018-01-27 21:01:04 +01:00
#Option "ConnectedMonitor" "{{ xorg.secondary.connector }}"
2017-07-08 13:37:35 +02:00
Option "UseDisplayDevice" "{{ xorg.secondary.connector }}"
2018-01-27 21:01:04 +01:00
#Option "CustomEDID" "{{ xorg.secondary.connector }}:/etc/X11/edid.{{ xorg.secondary.connector }}.bin"
2018-06-02 20:03:24 +02:00
Option "metamodes" "{{ xorg.secondary.connector }}: {{ xorg.secondary.mode }} +0+0 {ForceCompositionPipeline=Off, ForceFullCompositionPipeline=Off}"
2018-01-03 13:19:59 +01:00
Option "AllowIndirectGLXProtocol" "off"
Option "TripleBuffer" "on"
2017-07-08 13:37:35 +02:00
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection
{% endif %}
2018-06-02 20:03:24 +02:00
Section "Extensions"
Option "Composite" "Disable"
EndSection
2017-03-13 10:40:35 +01:00
#+END_SRC
2017-07-08 13:37:35 +02:00
#+BEGIN_SRC shell :tangle roles/template-test/templates/xorg.conf_test.j2
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2017-07-08 13:37:35 +02:00
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" "<?cs if:(?system.x11.display.0.device) ? ><?cs call:fix_display_name(system.x11.display.0.device) ? ><?cs else ? ><?cs var:system.x11.default ? ><?cs /if ? ><?cs if:(?system.x11.dualhead.enabled && system.x11.dualhead.enabled == 1) ? >, <?cs call:fix_display_name(system.x11.display.1.device) ? ><?cs /if ? >"
#Option "ConnectedMonitor"
"<?cs if:(?system.x11.display.0.device) ? >
<?cs call:fix_display_name(system.x11.display.0.device) ? >
<?cs else ? >
<?cs var:system.x11.default ? >
<?cs /if ? >
<?cs if:(?system.x11.dualhead.enabled && system.x11.dualhead.enabled == 1) ? >, <?cs call:fix_display_name(system.x11.display.1.device) ? ><?cs /if ? >"
# Option "UseDisplayDevice" "<?cs if:(?system.x11.display.0.device) ?><?cs call:fix_display_name(system.x11.display.0.device) ?><?cs else ?><?cs var:system.x11.default ?><?cs /if ?>"
# <?cs /if ?>
# <?cs if:(?system.hardware.nvidia.0.edid && system.hardware.nvidia.0.edid == "1") ?>
# Option "CustomEDID" "<?cs call:fix_display_name(system.x11.display.0.device) ?>:/etc/X11/edid.0.yavdr"
# <?cs /if ?>
# <?cs if:(system.hardware.nvidia.detected == 1 && ?system.x11.display.0.device) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.0.device) ?>: <?cs var:system.x11.display.0.default ?> { ViewPortIn=<?cs var:system.x11.display.0.viewport.in.x ?>x<?cs var:system.x11.display.0.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.0.viewport.out.x ?>x<?cs var:system.x11.display.0.viewport.out.y ?>+<?cs var:system.x11.display.0.viewport.out.plusx ?>+<?cs var:system.x11.display.0.viewport.out.plusy ?> }"
# <?cs each:mode = system.x11.display.0.mode ?><?cs if:(mode != system.x11.display.0.default) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.0.device) ?>: <?cs var:mode ?> { ViewPortIn=<?cs var:system.x11.display.0.viewport.in.x ?>x<?cs var:system.x11.display.0.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.0.viewport.out.x ?>x<?cs var:system.x11.display.0.viewport.out.y ?>+<?cs var:system.x11.display.0.viewport.out.plusx ?>+<?cs var:system.x11.display.0.viewport.out.plusy ?> }"<?cs /if ?><?cs /each ?>
{% 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
# <?cs if:(?system.x11.display.1.default && system.x11.display.1.default != "" && system.x11.display.1.default != "disabled") ?>
# Option "UseDisplayDevice" "<?cs call:fix_display_name(system.x11.display.1.device) ?>"
# <?cs /if ?>
# <?cs if:(?system.hardware.nvidia.1.edid && system.hardware.nvidia.1.edid == "1") ?>
# Option "CustomEDID" "<?cs call:fix_display_name(system.x11.display.1.device) ?>:/etc/X11/edid.1.yavdr"
# <?cs /if ?>
# <?cs if:(system.hardware.nvidia.detected == 1 && ?system.x11.display.1.device) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.1.device) ?>: <?cs var:system.x11.display.1.default ?> { ViewPortIn=<?cs var:system.x11.display.1.viewport.in.x ?>x<?cs var:system.x11.display.1.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.1.viewport.out.x ?>x<?cs var:system.x11.display.1.viewport.out.y ?>+<?cs var:system.x11.display.1.viewport.out.plusx ?>+<?cs var:system.x11.display.1.viewport.out.plusy ?> }"
# <?cs each:mode = system.x11.display.1.mode ?><?cs if:(mode != system.x11.display.1.default) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.1.device) ?>: <?cs var:mode ?> { ViewPortIn=<?cs var:system.x11.display.1.viewport.in.x ?>x<?cs var:system.x11.display.1.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.1.viewport.out.x ?>x<?cs var:system.x11.display.1.viewport.out.y ?>+<?cs var:system.x11.display.1.viewport.out.plusx ?>+<?cs var:system.x11.display.1.viewport.out.plusy ?> }"<?cs /if ?><?cs /each ?>
# <?cs /if ?>
EndSection
{% endif %}
#+END_SRC
2017-06-22 13:28:10 +02:00
**** vdr
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 748ef799-1673-4028-b52e-234328dc793b
:END:
2018-04-24 09:34:44 +02:00
Set environment variables for system locale and user session on startup
2017-06-22 13:28:10 +02:00
#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/vdr-environ.j2
[Service]
2018-04-24 09:34:44 +02:00
EnvironmentFile=-/etc/default/locale
2017-07-31 00:22:10 +02:00
Environment=XDG_RUNTIME_DIR= /run/user/ {{ vdr.uid }}/
2017-06-22 13:28:10 +02:00
EnvironmentFile=-/var/lib/vdr/ .session-env
#+END_SRC
2018-06-06 07:51:07 +02:00
*** files
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 13aff96c-0647-4a0e-8ab2-02a83c44f2ae
:END:
2018-06-06 07:51:07 +02:00
**** initramfs EDID hook
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 41434b9a-1580-4214-ba40-0e11e00ca82a
:END:
2018-06-06 07:51:07 +02:00
#+BEGIN_SRC shell :tangle roles/yavdr-xorg/files/cp-edid-data.sh
2018-06-08 19:54:17 +02:00
#!/bin/bash
# Created by yavdr-ansible.
# This hook copies EDID files with the naming scheme "edid.${OUTPUT}.bin" to the initramfs.
[ "$1" = "prereqs" ] && { echo "udev"; exit 0; }
# load hook helper functions
2018-06-06 07:51:07 +02:00
. /usr/share/initramfs-tools/hook-functions
2018-06-08 19:54:17 +02:00
rm /lib/firmware/edid/edid.*.bin
find "/etc/X11/ " -name "edid.*.bin" -type f -exec cp -t "/lib/firmware/edid/ " {} +
2018-06-06 07:51:07 +02:00
mkdir -p "${DESTDIR}/lib/firmware/edid"
2018-06-08 19:54:17 +02:00
find "/etc/X11/ " -name "edid.*.bin" -type f -exec cp -t "${DESTDIR}/lib/firmware/edid/ " {} +
2018-06-06 07:51:07 +02:00
manual_add_modules i915 radeon
exit 0
#+END_SRC
2017-12-17 10:38:12 +01:00
2018-02-12 08:48:12 +01:00
** yavdr-desktop
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 8cb30c4c-39df-4d93-8ae1-652cf4c5b027
:END:
2018-02-12 08:48:12 +01:00
*** Tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: aeb5167d-d3cb-4a0a-9851-9899b5239547
:END:
2018-02-12 08:48:12 +01:00
**** main.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: ff552cae-e390-49e0-80cf-399896839688
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC yaml :tangle roles/yavdr-desktop/tasks/main.yml :mkdirp yes :padline no
---
# file: roles/yavdr-desktop/tasks/main.yml
2017-06-20 15:09:15 +02:00
2018-02-12 08:48:12 +01:00
- 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'
2018-09-30 10:17:20 +02:00
- '{{ vdr.home }}/bin'
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
- name: expand template for .xinitrc for vdr user
template:
src: 'templates/.xinitrc.j2'
dest: '{{ vdr.home }}/.xinitrc'
mode: 0755
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
- name: "expand template for vdr's .Xresources"
template:
src: 'templates/.Xresources.j2'
dest: '{{ vdr.home }}/.Xresources'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
- name: expand template for openbox autostart
template:
src: 'templates/openbox/autostart.j2'
dest: '{{ vdr.home }}/.config/openbox/autostart'
mode: 0755
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
- name: expand rc.xml for openbox
template:
src: 'templates/openbox/rc.xml.j2'
dest: '{{ vdr.home }}/.config/openbox/rc.xml'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-06-21 12:46:51 +02:00
2018-08-05 13:57:19 +02:00
- name: expand rc2.xml for openbox on second display
template:
src: 'templates/openbox/rc2.xml.j2'
dest: '{{ vdr.home }}/.config/openbox/rc2.xml'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2018-02-12 08:48:12 +01:00
- name: create yavdr-desktop.target for the user session
template:
src: 'templates/systemd/user/yavdr-desktop.target.j2'
dest: '{{ vdr.home }}/.config/systemd/user/yavdr-desktop.target'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
- name: disable pulseaudio autospawning
lineinfile:
path: '{{ vdr.home }}/.config/pulse/client.conf'
line: 'autospawn = yes'
create: yes
state: present
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
- name: create tmux.service for the session
template:
src: 'templates/systemd/user/tmux.service.j2'
dest: '{{ vdr.home }}/.config/systemd/user/tmux.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
- name: create wm-exit.service for the session
template:
src: templates/systemd/user/wm-exit.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/wm-exit.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-07-31 12:26:50 +02:00
2018-02-12 08:48:12 +01:00
- name: create detect-second-display.service for the session
template:
src: templates/systemd/user/detect-second-display.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/detect-second-display.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-07-31 12:26:50 +02:00
2018-09-30 10:17:20 +02:00
- name: create detect-second-diplay script
template:
src: templates/bin/detect-second-display.j2
dest: '{{ vdr.home }}/bin/detect-second-display'
mode: 0755
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2018-09-30 10:57:26 +02:00
- name: create switch-displays script
template:
src: templates/bin/switch-displays.j2
dest: '{{ vdr.home }}/bin/switch-displays'
mode: 0755
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2018-02-12 08:48:12 +01:00
- name: create openbox-second.service for the session
template:
src: templates/systemd/user/openbox-second.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/openbox-second.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2017-12-20 10:43:15 +01:00
2018-02-12 08:48:12 +01:00
- name: create osd2web.service for the session
template:
src: templates/systemd/user/osd2web.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/osd2web.service'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0644
2017-12-20 10:43:15 +01:00
2018-02-12 08:48:12 +01:00
- name: create irexec configuration for the session
block:
- template:
src: templates/systemd/user/irexec.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/irexec.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- template:
src: templates/.lircrc.j2
dest: '{{ vdr.home }}/.lircrc'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
2018-09-30 10:38:20 +02:00
force: no
2018-02-12 08:48:12 +01:00
- name: link /usr/bin/start-desktop to /var/lib/vdr/plugins/desktop/starter
file:
src: /usr/bin/start-desktop
dest: /var/lib/vdr/plugins/desktop/starter
state: link
2018-04-24 09:56:29 +02:00
- name: enable and start yavdr-xorg for the vdr user
2018-02-12 08:48:12 +01:00
systemd:
daemon_reload: yes
2018-04-24 09:56:29 +02:00
name: 'yavdr-xorg'
2018-02-12 08:48:12 +01:00
enabled: yes
state: started
2017-12-20 10:43:15 +01:00
#+END_SRC
2018-02-12 08:48:12 +01:00
*** Templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0bbfaf8b-c242-4f0a-9ea0-ea4bfbb438ca
:END:
2018-02-12 10:27:01 +01:00
**** xorg configuration
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 074c7a42-44a9-4456-843e-f58e66f3b5fc
:END:
2018-02-12 09:14:14 +01:00
***** .Xresources
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: ca7cce7d-bb28-4063-acd4-7831ea74eb10
:END:
2018-02-12 09:14:14 +01:00
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/ .Xresources.j2 :mkdirp yes :padline no
xterm*background: Black
xterm*foreground: grey
XTerm*locale: true
XTerm*metaSendsEscape: true
XTerm*eightBitInput: false
XTerm*backarrowKey: false
XTerm*ttyModes: erase ^?
Xterm*saveLines: 4096
XTerm.vt100.metaSendsEscape: true
XTerm.vt100.geometry: 80x32
XTerm.vt100.renderFont: true
xterm*faceName: xft:DejaVu Sans Mono
xterm*faceSize: 14
xterm*renderFont: true
XTerm.vt100.faceName: xft:DejaVu Sans Mono:size=12:antialias=false
XTerm.vt100.font: 7x13
#+END_SRC
2018-02-12 10:27:01 +01:00
***** .xinitrc
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 22f69dea-f6f6-407e-b9d5-7edc38f88093
:END:
2018-02-12 10:27:01 +01:00
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/ .xinitrc.j2 :mkdirp yes :padline no
#!/bin/bash
{{ ansible_managed | comment }}
exec openbox-session
#+END_SRC
2017-06-20 15:09:15 +02:00
**** openbox
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: caaba2f6-165c-4bce-b897-fd68992e51c1
:END:
2017-06-21 12:46:51 +02:00
***** autostart
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 54bb62c1-99dd-42ea-b49f-269a9f8d4a68
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/openbox/autostart.j2 :mkdirp yes :shebang #!/bin/bash
2017-06-21 12:46:51 +02:00
# forward environment variables to an environment file and the systemd user session
2017-04-10 13:24:40 +02:00
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
2017-12-20 13:31:36 +01:00
feh --bg-center "/usr/share/yavdr/images/yavdr_logo.png"
2017-07-30 21:55:48 +02:00
enabled_services=(
"tmux.service" "detect-second-display.service"
"openbox-second.service" "osd2web.service"
2017-07-30 23:09:58 +02:00
"yavdr-frontend.service" "pulseaudio.socket"
2017-12-20 11:00:15 +01:00
"pulseaudio.service" "wm-exit.service" "irexec.service")
2017-06-21 12:46:51 +02:00
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
2017-04-10 13:24:40 +02:00
if which dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR
fi
2017-06-20 15:09:15 +02:00
# start systemd units for the yavdr user session
systemctl --user isolate yavdr-desktop.target
#+END_SRC
2017-06-21 12:46:51 +02:00
***** rc.xml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 8228f9e3-e6c6-4ecd-9157-f22533dba6d8
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC xml :tangle roles/yavdr-desktop/templates/openbox/rc.xml.j2 :mkdirp yes :padline no
2017-06-20 16:38:38 +02:00
<?xml version="1.0" encoding="UTF-8"? >
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude" >
<!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. -->
<resistance >
<strength >10</strength >
<screen_edge_strength >20</screen_edge_strength >
</resistance >
<focus >
<focusNew >yes</focusNew >
<!-- always try to focus new windows when they appear. other rules do
apply -->
<followMouse >no</followMouse >
<!-- move focus to a window when you move the mouse into it -- >
<focusLast >yes</focusLast >
<!-- focus the last used window when changing desktops, instead of the one
under the mouse pointer. when followMouse is enabled -->
<underMouse >no</underMouse >
<!-- move focus under the mouse, even when the mouse is not moving -- >
<focusDelay >200</focusDelay >
<!-- when followMouse is enabled, the mouse must be inside the window for
this many milliseconds (1000 = 1 sec) before moving focus to it -->
<raiseOnFocus >no</raiseOnFocus >
<!-- when followMouse is enabled, and a window is given focus by moving the
mouse into it, also raise the window -->
</focus >
<placement >
<policy >Smart</policy >
<!-- 'Smart' or 'UnderMouse' -- >
<center >yes</center >
<!-- whether to place windows in the center of the free area found or
the top left corner -->
<monitor >Active</monitor >
<!-- with Smart placement on a multi-monitor system, try to place new windows
on: 'Any' - any monitor, 'Mouse' - where the mouse is, 'Active' - where
the active window is, 'Primary' - only on the primary monitor -->
<primaryMonitor >Active</primaryMonitor >
<!-- The monitor where Openbox should place popup dialogs such as the
focus cycling popup, or the desktop switch popup. It can be an index
from 1, specifying a particular monitor. Or it can be one of the
following: 'Mouse' - where the mouse is, or
'Active' - where the active window is -->
</placement >
<theme >
<name >Onyx</name >
<titleLayout >NLIMC</titleLayout >
<!--
available characters are NDSLIMC, each can occur at most once.
N: window icon
L: window label (AKA title).
I: iconify
M: maximize
C: close
S: shade (roll up/down)
D: omnipresent (on all desktops).
-->
2017-12-26 20:47:38 +01:00
<keepBorder >no</keepBorder >
2017-06-20 16:38:38 +02:00
<animateIconify >yes</animateIconify >
<font place="ActiveWindow" >
<name >sans</name >
<size >8</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="InactiveWindow" >
<name >sans</name >
<size >8</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="MenuHeader" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >normal</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="MenuItem" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >normal</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="ActiveOnScreenDisplay" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="InactiveOnScreenDisplay" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
</theme >
<desktops >
<!-- this stuff is only used at startup, pagers allow you to change them
during a session
these are default values to use when other ones are not already set
by other applications, or saved in your session
use obconf if you want to change these without having to log out
and back in -->
<number >2</number >
<firstdesk >1</firstdesk >
<names >
<!-- set names up here if you want to, like this:
<name >desktop 1</name >
<name >desktop 2</name >
2017-06-20 15:09:15 +02:00
-->
2017-06-20 16:38:38 +02:00
</names >
<popupTime >875</popupTime >
<!-- The number of milliseconds to show the popup for when switching
desktops. Set this to 0 to disable the popup. -->
</desktops >
<resize >
<drawContents >yes</drawContents >
<popupShow >Nonpixel</popupShow >
<!-- 'Always', 'Never', or 'Nonpixel' (xterms and such) -- >
<popupPosition >Center</popupPosition >
<!-- 'Center', 'Top', or 'Fixed' -- >
<popupFixedPosition >
<!-- these are used if popupPosition is set to 'Fixed' -- >
<x >10</x >
<!-- positive number for distance from left edge, negative number for
distance from right edge, or 'Center' -->
<y >10</y >
<!-- positive number for distance from top edge, negative number for
distance from bottom edge, or 'Center' -->
</popupFixedPosition >
</resize >
<!-- You can reserve a portion of your screen where windows will not cover when
they are maximized, or when they are initially placed.
Many programs reserve space automatically, but you can use this in other
cases. -->
<margins >
<top >0</top >
<bottom >0</bottom >
<left >0</left >
<right >0</right >
</margins >
<dock >
<position >TopLeft</position >
<!-- (Top|Bottom)(Left|Right|)|Top|Bottom|Left|Right|Floating -- >
<floatingX >0</floatingX >
<floatingY >0</floatingY >
<noStrut >no</noStrut >
<stacking >Above</stacking >
<!-- 'Above', 'Normal', or 'Below' -- >
<direction >Vertical</direction >
<!-- 'Vertical' or 'Horizontal' -- >
<autoHide >no</autoHide >
<hideDelay >300</hideDelay >
<!-- in milliseconds (1000 = 1 second) -- >
<showDelay >300</showDelay >
<!-- in milliseconds (1000 = 1 second) -- >
<moveButton >Middle</moveButton >
<!-- 'Left', 'Middle', 'Right' -- >
</dock >
<keyboard >
<chainQuitKey >C-g</chainQuitKey >
2019-01-04 14:19:00 +01:00
<!-- Keybindings for yavdr-frontend -- >
<keybind key="W-a" >
<action name="Execute" >
<command >frontend-dbus-send start</command >
</action >
</keybind >
<keybind key="W-s" >
<action name="Execute" >
<command >frontend-dbus-send stop</command >
</action >
</keybind >
<keybind key="W-x" >
<action name="Execute" >
<command >frontend-dbus-send switchbetween kodi vdr</command >
</action >
</keybind >
<keybind key="XF86HomePage" >
<action name="Execute" >
<command >frontend-dbus-send toggle</command >
</action >
</keybind >
2017-06-20 16:38:38 +02:00
<!-- Keybindings for desktop switching -- >
<keybind key="C-A-Left" >
<action name="GoToDesktop" >
<to >left</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="C-A-Right" >
<action name="GoToDesktop" >
<to >right</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="C-A-Up" >
<action name="GoToDesktop" >
<to >up</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="C-A-Down" >
<action name="GoToDesktop" >
<to >down</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Left" >
<action name="SendToDesktop" >
<to >left</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Right" >
<action name="SendToDesktop" >
<to >right</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Up" >
<action name="SendToDesktop" >
<to >up</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Down" >
<action name="SendToDesktop" >
<to >down</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="W-F1" >
<action name="GoToDesktop" >
<to >1</to >
</action >
</keybind >
<keybind key="W-F2" >
<action name="GoToDesktop" >
<to >2</to >
</action >
</keybind >
<keybind key="W-F3" >
<action name="GoToDesktop" >
<to >3</to >
</action >
</keybind >
<keybind key="W-F4" >
<action name="GoToDesktop" >
<to >4</to >
</action >
</keybind >
<keybind key="W-d" >
<action name="ToggleShowDesktop"/ >
</keybind >
<!-- Keybindings for windows -- >
<keybind key="A-F4" >
<action name="Close"/ >
</keybind >
<keybind key="A-Escape" >
<action name="Lower"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
</keybind >
<keybind key="A-space" >
<action name="ShowMenu" >
<menu >client-menu</menu >
</action >
</keybind >
<!-- Take a screenshot of the current window with scrot when Alt+Print are pressed -- >
<keybind key="A-Print" >
<action name="Execute" >
<command >scrot -s</command >
</action >
</keybind >
<!-- Keybindings for window switching -- >
<keybind key="A-Tab" >
<action name="NextWindow" >
<finalactions >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</finalactions >
</action >
</keybind >
<keybind key="A-S-Tab" >
<action name="PreviousWindow" >
<finalactions >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</finalactions >
</action >
</keybind >
<keybind key="C-A-Tab" >
<action name="NextWindow" >
<panels >yes</panels >
<desktop >yes</desktop >
<finalactions >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</finalactions >
</action >
</keybind >
<!-- Keybindings for window switching with the arrow keys -- >
<keybind key="W-S-Right" >
<action name="DirectionalCycleWindows" >
<direction >right</direction >
</action >
</keybind >
<keybind key="W-S-Left" >
<action name="DirectionalCycleWindows" >
<direction >left</direction >
</action >
</keybind >
<keybind key="W-S-Up" >
<action name="DirectionalCycleWindows" >
<direction >up</direction >
</action >
</keybind >
<keybind key="W-S-Down" >
<action name="DirectionalCycleWindows" >
<direction >down</direction >
</action >
</keybind >
</keyboard >
<mouse >
<dragThreshold >1</dragThreshold >
<!-- number of pixels the mouse must move before a drag begins -- >
<doubleClickTime >500</doubleClickTime >
<!-- in milliseconds (1000 = 1 second) -- >
<screenEdgeWarpTime >400</screenEdgeWarpTime >
<!-- Time before changing desktops when the pointer touches the edge of the
screen while moving a window, in milliseconds (1000 = 1 second).
Set this to 0 to disable warping -->
<screenEdgeWarpMouse >false</screenEdgeWarpMouse >
<!-- Set this to TRUE to move the mouse pointer across the desktop when
switching due to hitting the edge of the screen -->
<context name="Frame" >
<mousebind button="A-Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="A-Left" action="Click" >
<action name="Unshade"/ >
</mousebind >
<mousebind button="A-Left" action="Drag" >
<action name="Move"/ >
</mousebind >
<mousebind button="A-Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="A-Right" action="Drag" >
<action name="Resize"/ >
</mousebind >
<mousebind button="A-Middle" action="Press" >
<action name="Lower"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
</mousebind >
<mousebind button="A-Up" action="Click" >
2017-06-20 15:09:15 +02:00
<action name="GoToDesktop" >
2017-06-20 16:38:38 +02:00
<to >previous</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="A-Down" action="Click" >
2017-06-20 15:09:15 +02:00
<action name="GoToDesktop" >
2017-06-20 16:38:38 +02:00
<to >next</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="C-A-Up" action="Click" >
2017-06-20 15:09:15 +02:00
<action name="GoToDesktop" >
2017-06-20 16:38:38 +02:00
<to >previous</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="C-A-Down" action="Click" >
2017-06-20 15:09:15 +02:00
<action name="GoToDesktop" >
2017-06-20 16:38:38 +02:00
<to >next</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="A-S-Up" action="Click" >
2017-06-20 15:09:15 +02:00
<action name="SendToDesktop" >
2017-06-20 16:38:38 +02:00
<to >previous</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="A-S-Down" action="Click" >
2017-06-20 15:09:15 +02:00
<action name="SendToDesktop" >
2017-06-20 16:38:38 +02:00
<to >next</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="Titlebar" >
<mousebind button="Left" action="Drag" >
<action name="Move"/ >
</mousebind >
<mousebind button="Left" action="DoubleClick" >
<action name="ToggleMaximize"/ >
</mousebind >
<mousebind button="Up" action="Click" >
<action name="if" >
<shaded >no</shaded >
<then >
<action name="Shade"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
<action name="Lower"/ >
</then >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="Down" action="Click" >
<action name="if" >
<shaded >yes</shaded >
<then >
<action name="Unshade"/ >
<action name="Raise"/ >
</then >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="Titlebar Top Right Bottom Left TLCorner TRCorner BRCorner BLCorner" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Middle" action="Press" >
<action name="Lower"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="ShowMenu" >
<menu >client-menu</menu >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="Top" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >top</edge >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="Left" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >left</edge >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="Right" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >right</edge >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="Bottom" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >bottom</edge >
</action >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
2017-06-20 15:09:15 +02:00
<action name="ShowMenu" >
<menu >client-menu</menu >
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="TRCorner BRCorner TLCorner BLCorner" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Drag" >
<action name="Resize"/ >
</mousebind >
</context >
<context name="Client" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Middle" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
</context >
<context name="Icon" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
<action name="ShowMenu" >
<menu >client-menu</menu >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="ShowMenu" >
<menu >client-menu</menu >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="AllDesktops" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="ToggleOmnipresent"/ >
</mousebind >
</context >
<context name="Shade" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="ToggleShade"/ >
</mousebind >
</context >
<context name="Iconify" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="Iconify"/ >
</mousebind >
</context >
<context name="Maximize" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Middle" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="ToggleMaximize"/ >
</mousebind >
<mousebind button="Middle" action="Click" >
<action name="ToggleMaximize" >
<direction >vertical</direction >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="Right" action="Click" >
<action name="ToggleMaximize" >
<direction >horizontal</direction >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
</context >
<context name="Close" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="Close"/ >
</mousebind >
</context >
<context name="Desktop" >
<mousebind button="Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="C-A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="C-A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
2017-06-20 15:09:15 +02:00
</action >
2017-06-20 16:38:38 +02:00
</mousebind >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
</context >
<context name="Root" >
<!-- Menus -- >
<mousebind button="Middle" action="Press" >
<action name="ShowMenu" >
<menu >client-list-combined-menu</menu >
</action >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="ShowMenu" >
<menu >root-menu</menu >
</action >
</mousebind >
</context >
<context name="MoveResize" >
<mousebind button="Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
<mousebind button="A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
</context >
</mouse >
<menu >
<!-- You can specify more than one menu file in here and they are all loaded,
just don't make menu ids clash or, well, it'll be kind of pointless -->
<!-- default menu file (or custom one in $HOME/.config/openbox/) -- >
<!-- system menu files on Debian systems -- >
<file >/var/lib/openbox/debian-menu.xml</file >
<file >menu.xml</file >
<hideDelay >200</hideDelay >
<!-- if a press-release lasts longer than this setting (in milliseconds), the
menu is hidden again -->
<middle >no</middle >
<!-- center submenus vertically about the parent entry -- >
<submenuShowDelay >100</submenuShowDelay >
<!-- time to delay before showing a submenu after hovering over the parent
entry.
if this is a negative value, then the delay is infinite and the
submenu will not be shown until it is clicked on -->
<submenuHideDelay >400</submenuHideDelay >
<!-- time to delay before hiding a submenu when selecting another
entry in parent menu
if this is a negative value, then the delay is infinite and the
submenu will not be hidden until a different submenu is opened -->
<showIcons >yes</showIcons >
<!-- controls if icons appear in the client-list-(combined-)menu -- >
<manageDesktops >yes</manageDesktops >
<!-- show the manage desktops section in the client-list-(combined-)menu -- >
</menu >
<!--
# this is an example with comments through out. use these to make your
# own rules, but without the comments of course.
# you may use one or more of the name/class/role/title/type rules to specify
# windows to match
<application name="the window's _OB_APP_NAME property (see obxprop)"
class="the window's _OB_APP_CLASS property (see obxprop)"
groupname="the window's _OB_APP_GROUP_NAME property (see obxprop)"
groupclass="the window's _OB_APP_GROUP_CLASS property (see obxprop)"
role="the window's _OB_APP_ROLE property (see obxprop)"
title="the window's _OB_APP_TITLE property (see obxprop)"
type="the window's _OB_APP_TYPE property (see obxprob)..
(if unspecified, then it is 'dialog' for child windows)">
# you may set only one of name/class/role/title/type, or you may use more
# than one together to restrict your matches.
# the name, class, role, and title use simple wildcard matching such as those
# used by a shell. you can use * to match any characters and ? to match
# any single character.
# the type is one of: normal, dialog, splash, utility, menu, toolbar, dock,
# or desktop
# when multiple rules match a window, they will all be applied, in the
# order that they appear in this list
# each rule element can be left out or set to 'default' to specify to not
# change that attribute of the window
<decor >yes</decor >
# enable or disable window decorations
<shade >no</shade >
# make the window shaded when it appears, or not
<position force="no" >
# the position is only used if both an x and y coordinate are provided
# (and not set to 'default')
# when force is "yes", then the window will be placed here even if it
# says you want it placed elsewhere. this is to override buggy
# applications who refuse to behave
<x >center</x >
# a number like 50, or 'center' to center on screen. use a negative number
# to start from the right (or bottom for <y >), ie -50 is 50 pixels from
# the right edge (or bottom). use 'default' to specify using value
# provided by the application, or chosen by openbox, instead.
<y >200</y >
<monitor >1</monitor >
# specifies the monitor in a xinerama setup.
# 1 is the first head, or 'mouse' for wherever the mouse is
</position >
<size >
# the size to make the window.
<width >20</width >
# a number like 20, or 'default' to use the size given by the application.
# you can use fractions such as 1/2 or percentages such as 75% in which
# case the value is relative to the size of the monitor that the window
# appears on.
<height >30%</height >
</size >
<focus >yes</focus >
# if the window should try be given focus when it appears. if this is set
# to yes it doesn't guarantee the window will be given focus. some
# restrictions may apply, but Openbox will try to
<desktop >1</desktop >
# 1 is the first desktop, 'all' for all desktops
<layer >normal</layer >
# 'above', 'normal', or 'below'
<iconic >no</iconic >
# make the window iconified when it appears, or not
<skip_pager >no</skip_pager >
# asks to not be shown in pagers
<skip_taskbar >no</skip_taskbar >
# asks to not be shown in taskbars. window cycling actions will also
# skip past such windows
<fullscreen >yes</fullscreen >
# make the window in fullscreen mode when it appears
<maximized >true</maximized >
# 'Horizontal', 'Vertical' or boolean (yes/no)
</application >
# end of the example
-->
<applications >
<application title="softhddevice" >
<decor >no</decor >
2017-12-26 20:47:38 +01:00
<maximized >yes</maximized >
2017-06-20 16:38:38 +02:00
<!--<skip_pager >yes</skip_pager >-->
2017-06-21 12:46:51 +02:00
<skip_taskbar >no</skip_taskbar >
2017-06-20 15:09:15 +02:00
</application >
2018-09-11 14:31:46 +02:00
<application title="softhdcuvid" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
2018-02-12 10:36:04 +01:00
<application title="vaapidevice" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
2017-12-28 15:52:35 +01:00
<application class="VDR" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
2017-06-20 16:38:38 +02:00
<application title="browser" >
<decor >no</decor >
2017-12-26 20:47:38 +01:00
<maximized >yes</maximized >
2017-06-20 16:38:38 +02:00
<!--<skip_pager >yes</skip_pager >-->
2017-12-26 20:47:38 +01:00
<skip_taskbar >no</skip_taskbar >
2017-06-20 16:38:38 +02:00
</application >
<application title="osd2Web" >
<decor >no</decor >
2017-12-26 20:47:38 +01:00
<maximized >yes</maximized >
2017-06-20 16:38:38 +02:00
<!--<skip_pager >yes</skip_pager >-->
2017-12-26 20:47:38 +01:00
<skip_taskbar >no</skip_taskbar >
2017-06-20 16:38:38 +02:00
</application >
</applications >
</openbox_config >
2017-03-26 13:57:31 +02:00
2018-08-05 13:57:19 +02:00
#+END_SRC
***** rc2.xml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 64b5a3ba-0f2d-4f92-93d0-4c4fc312ed5d
:END:
2018-08-05 13:57:19 +02:00
#+BEGIN_SRC xml :tangle roles/yavdr-desktop/templates/openbox/rc2.xml.j2 :mkdirp yes :padline no
<?xml version="1.0" encoding="UTF-8"? >
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude" >
<!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. -->
<resistance >
<strength >10</strength >
<screen_edge_strength >20</screen_edge_strength >
</resistance >
<focus >
<focusNew >no</focusNew >
<!-- always try to focus new windows when they appear. other rules do
apply -->
<followMouse >no</followMouse >
<!-- move focus to a window when you move the mouse into it -- >
<focusLast >yes</focusLast >
<!-- focus the last used window when changing desktops, instead of the one
under the mouse pointer. when followMouse is enabled -->
<underMouse >no</underMouse >
<!-- move focus under the mouse, even when the mouse is not moving -- >
<focusDelay >200</focusDelay >
<!-- when followMouse is enabled, the mouse must be inside the window for
this many milliseconds (1000 = 1 sec) before moving focus to it -->
<raiseOnFocus >no</raiseOnFocus >
<!-- when followMouse is enabled, and a window is given focus by moving the
mouse into it, also raise the window -->
</focus >
<placement >
<policy >Smart</policy >
<!-- 'Smart' or 'UnderMouse' -- >
<center >yes</center >
<!-- whether to place windows in the center of the free area found or
the top left corner -->
<monitor >Active</monitor >
<!-- with Smart placement on a multi-monitor system, try to place new windows
on: 'Any' - any monitor, 'Mouse' - where the mouse is, 'Active' - where
the active window is, 'Primary' - only on the primary monitor -->
<primaryMonitor >Active</primaryMonitor >
<!-- The monitor where Openbox should place popup dialogs such as the
focus cycling popup, or the desktop switch popup. It can be an index
from 1, specifying a particular monitor. Or it can be one of the
following: 'Mouse' - where the mouse is, or
'Active' - where the active window is -->
</placement >
<theme >
<name >Onyx</name >
<titleLayout >NLIMC</titleLayout >
<!--
available characters are NDSLIMC, each can occur at most once.
N: window icon
L: window label (AKA title).
I: iconify
M: maximize
C: close
S: shade (roll up/down)
D: omnipresent (on all desktops).
-->
<keepBorder >no</keepBorder >
<animateIconify >yes</animateIconify >
<font place="ActiveWindow" >
<name >sans</name >
<size >8</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="InactiveWindow" >
<name >sans</name >
<size >8</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="MenuHeader" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >normal</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="MenuItem" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >normal</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="ActiveOnScreenDisplay" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
<font place="InactiveOnScreenDisplay" >
<name >sans</name >
<size >9</size >
<!-- font size in points -- >
<weight >bold</weight >
<!-- 'bold' or 'normal' -- >
<slant >normal</slant >
<!-- 'italic' or 'normal' -- >
</font >
</theme >
<desktops >
<!-- this stuff is only used at startup, pagers allow you to change them
during a session
these are default values to use when other ones are not already set
by other applications, or saved in your session
use obconf if you want to change these without having to log out
and back in -->
<number >2</number >
<firstdesk >1</firstdesk >
<names >
<!-- set names up here if you want to, like this:
<name >desktop 1</name >
<name >desktop 2</name >
-->
</names >
<popupTime >875</popupTime >
<!-- The number of milliseconds to show the popup for when switching
desktops. Set this to 0 to disable the popup. -->
</desktops >
<resize >
<drawContents >yes</drawContents >
<popupShow >Nonpixel</popupShow >
<!-- 'Always', 'Never', or 'Nonpixel' (xterms and such) -- >
<popupPosition >Center</popupPosition >
<!-- 'Center', 'Top', or 'Fixed' -- >
<popupFixedPosition >
<!-- these are used if popupPosition is set to 'Fixed' -- >
<x >10</x >
<!-- positive number for distance from left edge, negative number for
distance from right edge, or 'Center' -->
<y >10</y >
<!-- positive number for distance from top edge, negative number for
distance from bottom edge, or 'Center' -->
</popupFixedPosition >
</resize >
<!-- You can reserve a portion of your screen where windows will not cover when
they are maximized, or when they are initially placed.
Many programs reserve space automatically, but you can use this in other
cases. -->
<margins >
<top >0</top >
<bottom >0</bottom >
<left >0</left >
<right >0</right >
</margins >
<dock >
<position >TopLeft</position >
<!-- (Top|Bottom)(Left|Right|)|Top|Bottom|Left|Right|Floating -- >
<floatingX >0</floatingX >
<floatingY >0</floatingY >
<noStrut >no</noStrut >
<stacking >Above</stacking >
<!-- 'Above', 'Normal', or 'Below' -- >
<direction >Vertical</direction >
<!-- 'Vertical' or 'Horizontal' -- >
<autoHide >no</autoHide >
<hideDelay >300</hideDelay >
<!-- in milliseconds (1000 = 1 second) -- >
<showDelay >300</showDelay >
<!-- in milliseconds (1000 = 1 second) -- >
<moveButton >Middle</moveButton >
<!-- 'Left', 'Middle', 'Right' -- >
</dock >
<keyboard >
<chainQuitKey >C-g</chainQuitKey >
<!-- Keybindings for desktop switching -- >
<keybind key="C-A-Left" >
<action name="GoToDesktop" >
<to >left</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="C-A-Right" >
<action name="GoToDesktop" >
<to >right</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="C-A-Up" >
<action name="GoToDesktop" >
<to >up</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="C-A-Down" >
<action name="GoToDesktop" >
<to >down</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Left" >
<action name="SendToDesktop" >
<to >left</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Right" >
<action name="SendToDesktop" >
<to >right</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Up" >
<action name="SendToDesktop" >
<to >up</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="S-A-Down" >
<action name="SendToDesktop" >
<to >down</to >
<wrap >no</wrap >
</action >
</keybind >
<keybind key="W-F1" >
<action name="GoToDesktop" >
<to >1</to >
</action >
</keybind >
<keybind key="W-F2" >
<action name="GoToDesktop" >
<to >2</to >
</action >
</keybind >
<keybind key="W-F3" >
<action name="GoToDesktop" >
<to >3</to >
</action >
</keybind >
<keybind key="W-F4" >
<action name="GoToDesktop" >
<to >4</to >
</action >
</keybind >
<keybind key="W-d" >
<action name="ToggleShowDesktop"/ >
</keybind >
<!-- Keybindings for windows -- >
<keybind key="A-F4" >
<action name="Close"/ >
</keybind >
<keybind key="A-Escape" >
<action name="Lower"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
</keybind >
<keybind key="A-space" >
<action name="ShowMenu" >
<menu >client-menu</menu >
</action >
</keybind >
<!-- Take a screenshot of the current window with scrot when Alt+Print are pressed -- >
<keybind key="A-Print" >
<action name="Execute" >
<command >scrot -s</command >
</action >
</keybind >
<!-- Keybindings for window switching -- >
<keybind key="A-Tab" >
<action name="NextWindow" >
<finalactions >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</finalactions >
</action >
</keybind >
<keybind key="A-S-Tab" >
<action name="PreviousWindow" >
<finalactions >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</finalactions >
</action >
</keybind >
<keybind key="C-A-Tab" >
<action name="NextWindow" >
<panels >yes</panels >
<desktop >yes</desktop >
<finalactions >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</finalactions >
</action >
</keybind >
<!-- Keybindings for window switching with the arrow keys -- >
<keybind key="W-S-Right" >
<action name="DirectionalCycleWindows" >
<direction >right</direction >
</action >
</keybind >
<keybind key="W-S-Left" >
<action name="DirectionalCycleWindows" >
<direction >left</direction >
</action >
</keybind >
<keybind key="W-S-Up" >
<action name="DirectionalCycleWindows" >
<direction >up</direction >
</action >
</keybind >
<keybind key="W-S-Down" >
<action name="DirectionalCycleWindows" >
<direction >down</direction >
</action >
</keybind >
</keyboard >
<mouse >
<dragThreshold >1</dragThreshold >
<!-- number of pixels the mouse must move before a drag begins -- >
<doubleClickTime >500</doubleClickTime >
<!-- in milliseconds (1000 = 1 second) -- >
<screenEdgeWarpTime >400</screenEdgeWarpTime >
<!-- Time before changing desktops when the pointer touches the edge of the
screen while moving a window, in milliseconds (1000 = 1 second).
Set this to 0 to disable warping -->
<screenEdgeWarpMouse >false</screenEdgeWarpMouse >
<!-- Set this to TRUE to move the mouse pointer across the desktop when
switching due to hitting the edge of the screen -->
<context name="Frame" >
<mousebind button="A-Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="A-Left" action="Click" >
<action name="Unshade"/ >
</mousebind >
<mousebind button="A-Left" action="Drag" >
<action name="Move"/ >
</mousebind >
<mousebind button="A-Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="A-Right" action="Drag" >
<action name="Resize"/ >
</mousebind >
<mousebind button="A-Middle" action="Press" >
<action name="Lower"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
</mousebind >
<mousebind button="A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
<mousebind button="C-A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="C-A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
<mousebind button="A-S-Up" action="Click" >
<action name="SendToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="A-S-Down" action="Click" >
<action name="SendToDesktop" >
<to >next</to >
</action >
</mousebind >
</context >
<context name="Titlebar" >
<mousebind button="Left" action="Drag" >
<action name="Move"/ >
</mousebind >
<mousebind button="Left" action="DoubleClick" >
<action name="ToggleMaximize"/ >
</mousebind >
<mousebind button="Up" action="Click" >
<action name="if" >
<shaded >no</shaded >
<then >
<action name="Shade"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
<action name="Lower"/ >
</then >
</action >
</mousebind >
<mousebind button="Down" action="Click" >
<action name="if" >
<shaded >yes</shaded >
<then >
<action name="Unshade"/ >
<action name="Raise"/ >
</then >
</action >
</mousebind >
</context >
<context name="Titlebar Top Right Bottom Left TLCorner TRCorner BRCorner BLCorner" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Middle" action="Press" >
<action name="Lower"/ >
<action name="FocusToBottom"/ >
<action name="Unfocus"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="ShowMenu" >
<menu >client-menu</menu >
</action >
</mousebind >
</context >
<context name="Top" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >top</edge >
</action >
</mousebind >
</context >
<context name="Left" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >left</edge >
</action >
</mousebind >
</context >
<context name="Right" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >right</edge >
</action >
</mousebind >
</context >
<context name="Bottom" >
<mousebind button="Left" action="Drag" >
<action name="Resize" >
<edge >bottom</edge >
</action >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="ShowMenu" >
<menu >client-menu</menu >
</action >
</mousebind >
</context >
<context name="TRCorner BRCorner TLCorner BLCorner" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Drag" >
<action name="Resize"/ >
</mousebind >
</context >
<context name="Client" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Middle" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
</context >
<context name="Icon" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
<action name="ShowMenu" >
<menu >client-menu</menu >
</action >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="ShowMenu" >
<menu >client-menu</menu >
</action >
</mousebind >
</context >
<context name="AllDesktops" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="ToggleOmnipresent"/ >
</mousebind >
</context >
<context name="Shade" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="ToggleShade"/ >
</mousebind >
</context >
<context name="Iconify" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="Iconify"/ >
</mousebind >
</context >
<context name="Maximize" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Middle" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="ToggleMaximize"/ >
</mousebind >
<mousebind button="Middle" action="Click" >
<action name="ToggleMaximize" >
<direction >vertical</direction >
</action >
</mousebind >
<mousebind button="Right" action="Click" >
<action name="ToggleMaximize" >
<direction >horizontal</direction >
</action >
</mousebind >
</context >
<context name="Close" >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
<action name="Unshade"/ >
</mousebind >
<mousebind button="Left" action="Click" >
<action name="Close"/ >
</mousebind >
</context >
<context name="Desktop" >
<mousebind button="Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
<mousebind button="A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
<mousebind button="C-A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="C-A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
<mousebind button="Left" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="Focus"/ >
<action name="Raise"/ >
</mousebind >
</context >
<context name="Root" >
<!-- Menus -- >
<mousebind button="Middle" action="Press" >
<action name="ShowMenu" >
<menu >client-list-combined-menu</menu >
</action >
</mousebind >
<mousebind button="Right" action="Press" >
<action name="ShowMenu" >
<menu >root-menu</menu >
</action >
</mousebind >
</context >
<context name="MoveResize" >
<mousebind button="Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
<mousebind button="A-Up" action="Click" >
<action name="GoToDesktop" >
<to >previous</to >
</action >
</mousebind >
<mousebind button="A-Down" action="Click" >
<action name="GoToDesktop" >
<to >next</to >
</action >
</mousebind >
</context >
</mouse >
<menu >
<!-- You can specify more than one menu file in here and they are all loaded,
just don't make menu ids clash or, well, it'll be kind of pointless -->
<!-- default menu file (or custom one in $HOME/.config/openbox/) -- >
<!-- system menu files on Debian systems -- >
<file >/var/lib/openbox/debian-menu.xml</file >
<file >menu.xml</file >
<hideDelay >200</hideDelay >
<!-- if a press-release lasts longer than this setting (in milliseconds), the
menu is hidden again -->
<middle >no</middle >
<!-- center submenus vertically about the parent entry -- >
<submenuShowDelay >100</submenuShowDelay >
<!-- time to delay before showing a submenu after hovering over the parent
entry.
if this is a negative value, then the delay is infinite and the
submenu will not be shown until it is clicked on -->
<submenuHideDelay >400</submenuHideDelay >
<!-- time to delay before hiding a submenu when selecting another
entry in parent menu
if this is a negative value, then the delay is infinite and the
submenu will not be hidden until a different submenu is opened -->
<showIcons >yes</showIcons >
<!-- controls if icons appear in the client-list-(combined-)menu -- >
<manageDesktops >yes</manageDesktops >
<!-- show the manage desktops section in the client-list-(combined-)menu -- >
</menu >
<!--
# this is an example with comments through out. use these to make your
# own rules, but without the comments of course.
# you may use one or more of the name/class/role/title/type rules to specify
# windows to match
<application name="the window's _OB_APP_NAME property (see obxprop)"
class="the window's _OB_APP_CLASS property (see obxprop)"
groupname="the window's _OB_APP_GROUP_NAME property (see obxprop)"
groupclass="the window's _OB_APP_GROUP_CLASS property (see obxprop)"
role="the window's _OB_APP_ROLE property (see obxprop)"
title="the window's _OB_APP_TITLE property (see obxprop)"
type="the window's _OB_APP_TYPE property (see obxprob)..
(if unspecified, then it is 'dialog' for child windows)">
# you may set only one of name/class/role/title/type, or you may use more
# than one together to restrict your matches.
# the name, class, role, and title use simple wildcard matching such as those
# used by a shell. you can use * to match any characters and ? to match
# any single character.
# the type is one of: normal, dialog, splash, utility, menu, toolbar, dock,
# or desktop
# when multiple rules match a window, they will all be applied, in the
# order that they appear in this list
# each rule element can be left out or set to 'default' to specify to not
# change that attribute of the window
<decor >yes</decor >
# enable or disable window decorations
<shade >no</shade >
# make the window shaded when it appears, or not
<position force="no" >
# the position is only used if both an x and y coordinate are provided
# (and not set to 'default')
# when force is "yes", then the window will be placed here even if it
# says you want it placed elsewhere. this is to override buggy
# applications who refuse to behave
<x >center</x >
# a number like 50, or 'center' to center on screen. use a negative number
# to start from the right (or bottom for <y >), ie -50 is 50 pixels from
# the right edge (or bottom). use 'default' to specify using value
# provided by the application, or chosen by openbox, instead.
<y >200</y >
<monitor >1</monitor >
# specifies the monitor in a xinerama setup.
# 1 is the first head, or 'mouse' for wherever the mouse is
</position >
<size >
# the size to make the window.
<width >20</width >
# a number like 20, or 'default' to use the size given by the application.
# you can use fractions such as 1/2 or percentages such as 75% in which
# case the value is relative to the size of the monitor that the window
# appears on.
<height >30%</height >
</size >
<focus >yes</focus >
# if the window should try be given focus when it appears. if this is set
# to yes it doesn't guarantee the window will be given focus. some
# restrictions may apply, but Openbox will try to
<desktop >1</desktop >
# 1 is the first desktop, 'all' for all desktops
<layer >normal</layer >
# 'above', 'normal', or 'below'
<iconic >no</iconic >
# make the window iconified when it appears, or not
<skip_pager >no</skip_pager >
# asks to not be shown in pagers
<skip_taskbar >no</skip_taskbar >
# asks to not be shown in taskbars. window cycling actions will also
# skip past such windows
<fullscreen >yes</fullscreen >
# make the window in fullscreen mode when it appears
<maximized >true</maximized >
# 'Horizontal', 'Vertical' or boolean (yes/no)
</application >
# end of the example
-->
<applications >
<application title="softhddevice" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
2018-09-11 14:31:46 +02:00
<application title="softhdcuvid" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
2018-08-05 13:57:19 +02:00
<application title="vaapidevice" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
<application class="VDR" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
<application title="browser" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
<application title="osd2Web" >
<decor >no</decor >
<maximized >yes</maximized >
<!--<skip_pager >yes</skip_pager >-->
<skip_taskbar >no</skip_taskbar >
</application >
</applications >
</openbox_config >
2017-05-12 18:21:26 +02:00
#+END_SRC
2017-06-21 12:46:51 +02:00
2018-02-12 08:48:12 +01:00
**** Systemd User Session
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 71f6c6b1-567d-4337-af6f-873777351f30
:END:
2018-02-12 08:48:12 +01:00
***** yavdr-desktop.target
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 250ebcbf-647c-4d11-a310-60f9c50cb79f
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/systemd/user/yavdr-desktop.target.j2 :mkdirp yes :padline no
[Unit]
Description=yaVDR Desktop
Requires=default.target
After=default.target pulseaudio.service
Wants=dbus.service pulseaudio.service
AllowIsolate=yes
#+END_SRC
***** detect-second-display
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e46166b1-0550-41c6-a7ec-d7a2622f87db
:END:
2018-09-30 10:17:20 +02:00
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/bin/detect-second-display.j2 :mkdirp yes :padline no
#!/bin/bash
source <(systemctl --user show-environment)
SECOND_DISPLAY="${DISPLAY%\.[0-9]*}.1"
if xrandr -d "$SECOND_DISPLAY" -q | grep -q "connected"; then
[ "$DISPLAY" != "$SECOND_DISPLAY" ] && d= "DISPLAY=$SECOND_DISPLAY" || d= "DISPLAY=$DISPLAY"
echo "$d" > ~/.second_display;
else
rm -f ~/.second_display
fi
#+END_SRC
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-desktop/templates/systemd/user/detect-second-display.service.j2 :mkdirp yes :padline no
[Unit]
Description=Detect second DISPLAY using xrandr
[Service]
Type=oneshot
2018-09-30 10:57:26 +02:00
RemainAfterExit=yes
2018-09-30 10:17:20 +02:00
ExecStart=%h/bin/detect-second-display
2018-02-12 08:48:12 +01:00
[Install]
WantedBy=yavdr-desktop.target
#+END_SRC
2018-09-30 10:57:26 +02:00
***** switch-displays
:PROPERTIES:
:ID: 67d8bc4f-64c6-4433-98f7-d76430fb9f20
:END:
This script exchanges the primary and secondary screen. It needs access to the systemd user session.
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/bin/switch-displays.j2 :mkdirp yes :padline no
#!/bin/bash
source <(systemctl --user show-environment)
[[ "$DISPLAY" =~ \.1$ ]] && DISPLAY="${DISPLAY%.1}.0" || DISPLAY= "${DISPLAY%.0}.1"
frontend-dbus-send stop
systemctl --user stop osd2web
frontend-dbus-send setDisplay "$DISPLAY"
systemctl --user start osd2web
frontend-dbus-send start
#+END_SRC
2018-02-12 08:48:12 +01:00
***** openbox-second.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4473c272-7b60-4159-b2a9-8198cff98770
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-desktop/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]
EnvironmentFile=%h/.second_display
2018-08-05 13:57:19 +02:00
ExecStart=/usr/bin/openbox --config-file %h/ .config/openbox/rc2.xml
2018-05-18 10:34:16 +02:00
ExecStartPost=/usr/bin/xset -dpms s off -display $DISPLAY
2018-02-12 08:48:12 +01:00
ExecStartPost=/bin/bash %h/ .fehbg
[Install]
WantedBy=yavdr-desktop.target
#+END_SRC
***** osd2web.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 85647bf2-f42b-4621-9e61-a0e07b7a24e9
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-desktop/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
Environment=url= "http://localhost:4444/skins/horchiTft/index.html?theme=anthraize&onlyView=1"
Environment=browser= "kiosk-browser"
EnvironmentFile=-%h/.config/osd2web/config
ExecStart=/usr/bin/on_vdr -o -c '${browser} "${url}"'
KillSignal=SIGINT
[Install]
WantedBy=yavdr-desktop.target
#+END_SRC
***** tmux.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 89ca260c-48b5-4b27-b43b-02f7b02be80c
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-desktop/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
***** wm-exit.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: cec42c29-2b61-4b7a-8a94-f734b01519b1
:END:
2018-02-12 08:48:12 +01:00
#+BEGIN_SRC conf :tangle roles/yavdr-desktop/templates/systemd/user/wm-exit.service.j2 :mkdirp yes :padline no
[Unit]
Description=exit window manager gracefully
[Service]
ExecStart=/bin/true
ExecStop=/usr/bin/openbox --exit
RemainAfterExit=True
[Install]
WantedBy=default.target
#+END_SRC
**** irexec
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: ea17fdbd-334b-4b78-817f-52fed11be2f1
:END:
2018-02-12 08:48:12 +01:00
irexec.service starts irexec for the user session
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/systemd/user/irexec.service.j2 :mkdirp yes :padline no
[Unit]
Description=LIRC command handler
[Service]
Type=simple
ExecStart=/usr/bin/irexec %h/ .lircrc
[Install]
WantedBy=yavdr-desktop.target
#+END_SRC
~/.lircrc contains the irexec configuration
#+BEGIN_SRC shell :tangle roles/yavdr-desktop/templates/ .lircrc.j2 :mkdirp yes :padline no
begin
prog = irexec
button = KEY_HOME
config = frontend-dbus-send switchbetween kodi vdr
end
#+END_SRC
2017-02-23 13:15:04 +01:00
** samba-install
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: b51f567b-30cd-4cdf-8541-c07d9e423398
:END:
2017-02-23 13:15:04 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: ac75cc29-c841-42d7-b7c7-b4a9fd38f19e
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/samba-install/tasks/main.yml :mkdirp yes :padline no
---
2017-02-23 13:15:04 +01:00
# file: roles/samba-install/tasks/main.yml
- name: install samba server
apt:
2018-10-05 17:49:39 +02:00
name:
- samba
- samba-common
- samba-common-bin
- tdb-tools
2017-02-23 13:15:04 +01:00
state: present
install_recommends: no
#+END_SRC
** samba-config
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a5db25c9-5dd6-4432-9d9b-d81945c67711
:END:
2017-02-23 13:15:04 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c8f2d766-6c69-49e5-b14a-2f9d4dc25b63
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/samba-config/tasks/main.yml :mkdirp yes :padline no
---
2017-02-23 13:15:04 +01:00
# file: roles/samba-config/tasks/main.yml
# TODO:
2017-06-20 15:09:15 +02:00
# - name: divert original smbd.conf
2017-02-23 13:15:04 +01:00
2017-03-13 10:40:35 +01:00
- name: touch smb.conf.custom
2017-02-23 13:15:04 +01:00
file:
state: touch
dest: '/etc/samba/smb.conf.custom'
notify: [ 'Restart Samba' ]
- name: expand template for smb.conf
template:
src: 'templates/smb.conf.j2'
dest: '/etc/samba/smb.conf'
#validate: 'testparm -s %s'
notify: [ 'Restart Samba' ]
#+END_SRC
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 334714ba-dd03-4e85-a1d8-c2e8707a3fa1
:END:
2017-03-13 10:40:35 +01:00
**** smb.conf
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9bb9f2b8-f364-4cf1-b7ab-1b3ae0f3ff32
:END:
2017-03-13 10:40:35 +01:00
***** global settings
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 48d03a2e-c6d6-4f60-b34b-604088352c24
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/samba-config/templates/smb.conf.j2 :mkdirp yes :padline no
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2017-02-23 13:15:04 +01:00
#======================= Global Settings = ======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = {{ samba.workgroup }}
# server string is the equivalent of the NT Description field
server string = %h server (Samba, Ubuntu)
# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
max log size = 1000
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
# security = user
# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam
obey pam restrictions = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s* \spassword:* %n\n *Retype\snew\s* \spassword:* %n\n *password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user
2017-03-13 10:40:35 +01:00
{% if samba.windows_compatible %}
# disable unix extensions and enable following symlinks
unix extensions = no
follow symlinks= yes
wide links= yes
{% endif %}
#+END_SRC
***** media directories
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 19a7e6f8-5795-45ff-983e-9da37e7dce26
:END:
2017-03-13 10:40:35 +01:00
#+BEGIN_SRC yaml :tangle roles/samba-config/templates/smb.conf.j2 :mkdirp yes
2017-02-23 13:15:04 +01:00
{% for name, path in media_dirs.iteritems() %}
[{{ name }}]
path = {{ path }}
comment = {{ name }} on %h
guest ok = yes
writeable = yes
browseable = yes
create mode = 0664
directory mode = 0775
force user = {{ vdr.user }}
force group = {{ vdr.group }}
follow symlinks = yes
wide links = yes
{% endfor %}
2017-03-13 10:40:35 +01:00
#+END_SRC
***** include custom samba exports
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 65e56ad5-118f-491b-8e58-8e2c5f90b6a2
:END:
2017-03-13 10:40:35 +01:00
#+BEGIN_SRC yaml :tangle roles/samba-config/templates/smb.conf.j2 :mkdirp yes
2017-02-23 13:15:04 +01:00
include = /etc/samba/smb.conf.custom
#+END_SRC
2017-06-20 15:09:15 +02:00
** STARTED autoinstall-drivers
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 2802c8ea-614e-4b9b-8c3e-cd7efc0f4f0e
:END:
2017-03-13 19:34:54 +01:00
It would be nice to be able to detect if it is suitable to install those drivers:
2017-07-08 13:37:35 +02:00
*** TODO sundtek for Sundtek devices (local or network connection)
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 8b66ce8d-0095-4fbd-8868-8bc5c43d19fc
:END:
2017-03-13 22:25:32 +01:00
Vendor-IDs:
- eb1a:5[1b2] (alte Generation)
- 2659:* (neuere Sticks)
2018-08-05 13:57:19 +02:00
**** planned packages
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: f5970635-da3e-4929-a17c-3226b69497c5
:END:
2018-08-05 13:57:19 +02:00
- yavdr-hardware-sundtek
- python3-sundtek
- yavdr-backend-sundtek
2018-05-06 16:32:39 +02:00
*** TODO drivers for TT S2-6400 FF
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 257ce3b7-ecfc-4e13-b394-f3b0707be30a
:END:
2018-05-06 16:32:39 +02:00
https://github.com/s-moch/linux-saa716x - kann man den relevanten Teil als dkms-Paket bauen?
2017-06-20 15:09:15 +02:00
** autoinstall-ubuntu-drivers
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a9c88346-c91c-4d02-8dac-19148795d4df
:END:
2017-06-20 15:09:15 +02:00
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
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: bfe4d498-7d66-4e5f-85b1-d60e29cf309a
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml :padline no
2017-06-20 16:38:38 +02:00
---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml
2017-06-20 15:09:15 +02:00
2017-11-22 10:09:51 +01:00
- name: autoinstall ubuntu-drivers-common
block:
- name: apt | install ubuntu-drivers-common
apt:
name: ubuntu-drivers-common
state: present
2017-06-20 15:09:15 +02:00
2017-11-22 10:56:21 +01:00
- name: use ubuntu-drivers to install additional drivers automatically
2017-11-22 10:09:51 +01:00
command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall
2018-04-19 11:55:03 +02:00
when: (ansible_virtualization_type != "virtualbox" and ansible_virtualization_role != "guest")
2017-12-16 18:58:57 +01:00
# ubuntu-drivers-common tries to autoinstall
2018-04-19 11:55:03 +02:00
# conflicting packages for virtualbox in Ubuntu 16.04 and 18.04 :(
2017-11-22 10:09:51 +01:00
#+END_SRC
** autoinstall-virtualbox-guest
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: f03f3758-9188-4e98-a26a-bbddf14d8194
:END:
2019-01-04 14:17:13 +01:00
This role installs the guest additions for virtualbox guests on Ubuntu 18.04
2017-11-22 10:09:51 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-virtualbox-guest/tasks/main.yml :padline no
---
# file roles/autoinstall-virtualbox-guest/tasks/main.yml
2017-06-20 15:09:15 +02:00
2017-11-22 10:09:51 +01:00
- name: install virtualbox guest additions
block:
- name: install packages
apt:
state: present
2018-10-05 17:49:39 +02:00
name:
- dkms
- virtualbox-guest-x11-hwe
- virtualbox-guest-dkms-hwe
- virtualbox-guest-x11-hwe
2017-11-22 10:56:21 +01:00
# TODO: set xineliboutput as frontend
2017-11-22 10:09:51 +01:00
when:
- ansible_virtualization_type == "virtualbox"
- ansible_virtualization_role == "guest"
- ansible_distribution == "Ubuntu"
2018-02-12 16:37:41 +01:00
- name: set xineliboutput as frontend
2018-02-12 16:40:58 +01:00
block:
- apt:
2018-10-05 17:49:39 +02:00
name:
- vdr-plugin-xineliboutput
- xineliboutput-sxfe
2018-02-12 16:40:58 +01:00
state: present
- command: '{{ item }}'
with_items:
- vdrctl disable softhddevice
- vdrctl disable vaapidevice
- vdrctl disable xine
- vdrctl disable pvr350
- vdrctl enable xineliboutput
ignore_errors: yes
2018-02-12 16:37:41 +01:00
when:
2018-09-04 13:21:32 +02:00
- ansible_virtualization_type == "virtualbox" or ansible_virtualization_type = = "VMware"
2018-02-12 16:37:41 +01:00
- ansible_virtualization_role == "guest"
2017-06-20 15:09:15 +02:00
#+END_SRC
2018-01-01 22:39:10 +01:00
** autoinstall-atric-usb
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 441a8ccf-4865-4999-8aa9-ec42925316c0
:END:
2018-01-01 22:39:10 +01:00
*** dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: bd31f64a-a1d7-4f3e-81a8-f7bd3091a400
:END:
2018-01-01 22:53:47 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-atric-usb/meta/main.yml :padline no
2018-01-01 22:39:10 +01:00
---
dependencies:
2018-01-16 12:06:02 +01:00
- { role: collect-facts }
2018-01-01 22:39:10 +01:00
- { role: yavdr-remote }
#+END_SRC
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 90c74869-6107-4fcc-b407-73311d0ed052
:END:
2018-01-01 22:39:10 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-atric-usb/tasks/main.yml :padline no
---
# file roles/autoinstall-atric-usb/tasks/main.yml
- name: install and configure Atric IR-WakeupUSB
block:
- name: apt | install lirc-drv-irman
2018-01-01 22:54:47 +01:00
apt:
name: lirc-drv-irman
state: present
2018-01-05 10:57:31 +01:00
tags:
- packages
2018-01-01 22:39:10 +01:00
- name: write lirc configuration
2018-01-01 22:55:59 +01:00
template:
2018-01-01 23:02:40 +01:00
src: templates/lirc_options.conf.j2
dest: /etc/lirc/lirc_options.conf
2018-01-05 10:57:31 +01:00
tags:
- config
- systemd
2018-01-01 22:39:10 +01:00
2018-01-05 10:57:31 +01:00
- name: enable lircd, eventlircd, lircd2uinput
2018-01-01 22:55:59 +01:00
systemd:
2018-01-05 10:57:31 +01:00
name: '{{ item }}'
2018-01-01 22:55:59 +01:00
enabled: yes
state: started
masked: no
daemon_reload: yes
2018-01-05 10:57:31 +01:00
with_items:
2018-01-07 17:35:04 +01:00
- eventlircd.service
2018-01-05 10:57:31 +01:00
- lircd2uinput.service
- lircd.service
tags:
- systemd
2018-01-01 22:39:10 +01:00
2018-01-16 09:12:11 +01:00
when: '"04d8:f844" in usb'
2018-01-01 22:39:10 +01:00
#+END_SRC
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 8aa2416a-1e9e-447a-9a46-0c51f420362d
:END:
2018-01-01 23:02:40 +01:00
#+BEGIN_SRC conf :tangle roles/autoinstall-atric-usb/templates/lirc_options.conf.j2 :padline no
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2018-01-01 22:39:10 +01:00
[lircd]
nodaemon = False
driver = irman
device = /dev/irman
output = /var/run/lirc/lircd0
pidfile = /var/run/lirc/lircd0.pid
plugindir = /usr/lib/x86_64-linux-gnu/lirc/plugins
permission = 666
allow-simulate = No
repeat-max = 600
#loglevel = 6
#release = true
#release_suffix = _EVUP
#logfile = ...
#driver-options = ...
2018-01-16 09:05:08 +01:00
[lircmd]
uinput = False
nodaemon = False
#+END_SRC
** autoinstall-yausbir
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 40f32214-150d-4d42-8020-6ff4b7014ec8
:END:
2018-01-16 09:05:08 +01:00
*** dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 82eda971-87c9-4f37-a97b-b935a29abbe4
:END:
2018-01-16 09:05:08 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-yausbir/meta/main.yml :padline no
---
dependencies:
- { role: yavdr-remote }
#+END_SRC
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: f67c193a-1ebc-4bf9-8de3-7dd623efab83
:END:
2018-01-16 09:05:08 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-yausbir/tasks/main.yml :padline no
---
# file roles/autoinstall-atric-usb/tasks/main.yml
- name: install and configure Atric IR-WakeupUSB
block:
- name: apt | install lirc-drv-yausbir
apt:
name: lirc-drv-yausbir
state: present
tags:
- packages
- name: write lirc configuration
template:
src: templates/lirc_options.conf.j2
dest: /etc/lirc/lirc_options.conf
tags:
- config
- systemd
- name: enable lircd, eventlircd, lircd2uinput
systemd:
name: '{{ item }}'
enabled: yes
state: started
masked: no
daemon_reload: yes
with_items:
- eventlircd.service
- lircd2uinput.service
- lircd.service
tags:
- systemd
2018-01-16 09:12:11 +01:00
when: '"10c4:876c" in usb'
2018-01-16 09:05:08 +01:00
#+END_SRC
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 81390e92-fff1-477a-b73c-457c0871b006
:END:
2018-01-16 09:05:08 +01:00
#+BEGIN_SRC conf :tangle roles/autoinstall-yausbir/templates/lirc_options.conf.j2 :padline no
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2018-01-16 09:05:08 +01:00
[lircd]
nodaemon = False
2018-01-16 09:14:45 +01:00
driver = ya_usbir
2018-01-16 09:05:08 +01:00
output = /var/run/lirc/lircd0
pidfile = /var/run/lirc/lircd0.pid
plugindir = /usr/lib/x86_64-linux-gnu/lirc/plugins
permission = 666
allow-simulate = No
repeat-max = 600
#loglevel = 6
#release = true
#release_suffix = _EVUP
#logfile = ...
#driver-options = ...
2018-01-01 22:39:10 +01:00
[lircmd]
uinput = False
nodaemon = False
#+END_SRC
2017-03-02 09:38:05 +01:00
** autoinstall-satip
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: feb9bdba-779b-4da9-bfb0-cf54965098ff
:END:
2017-06-20 15:09:15 +02:00
If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip is installed.
2017-03-02 09:38:05 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 90b74afd-7633-42d3-9681-8c0c17371985
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-satip/tasks/main.yml :padline no
2017-03-02 09:38:05 +01:00
---
# file roles/autoinstall-satip/tasks/main.yml
2017-03-13 19:34:54 +01:00
- name: "detect SAT>IP Server(s) on the network"
action: satip_facts
- debug:
2017-09-04 12:29:53 +02:00
var: satip_devices
2017-03-13 19:34:54 +01:00
verbosity: 1
2017-03-02 16:01:52 +01:00
- name: apt | install vdr-plugin-satip if a Sat>IP server has been detected
2017-03-02 09:38:05 +01:00
apt:
name: vdr-plugin-satip
2017-11-20 09:45:15 +01:00
state: present
2017-09-04 12:29:53 +02:00
when: satip_devices
2017-03-13 19:34:54 +01:00
notify: [ 'Restart VDR' ]
2017-03-02 09:38:05 +01:00
#+END_SRC
2017-03-02 16:01:52 +01:00
** autoinstall-targavfd
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0902fe6d-ed20-49cb-b88b-04a427ee6d71
:END:
2017-03-02 16:01:52 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 1d70ce53-7f40-4ca4-8ac0-ed37417fd720
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-targavfd/tasks/main.yml :padline no
2017-03-02 16:01:52 +01:00
---
# file roles/autoinstall-targavfd/tasks/main.yml
- name: apt | install vdr-plugin-targavfd if connected
apt:
name: vdr-plugin-targavfd
2017-09-04 12:29:53 +02:00
when: '"19c2:6a11" in usb'
2017-03-13 19:34:54 +01:00
notify: [ 'Restart VDR' ]
2017-03-02 16:01:52 +01:00
#+END_SRC
** autoinstall-imonlcd
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 53d26502-d69e-49e0-99b9-e21527c5577d
:END:
2017-03-02 16:01:52 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 3d06c913-1130-44cd-b1d3-30ece9135bca
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-imonlcd/tasks/main.yml :padline no
2017-03-02 16:01:52 +01:00
---
# file roles/autoinstall-imonlcd/tasks/main.yml
- name: apt | install vdr-plugin-imonlcd if connected
apt:
name: vdr-plugin-imonlcd
2017-09-04 12:29:53 +02:00
when: '"15c2:0038" in usb or "15c2:ffdc" in usb'
2017-03-13 19:34:54 +01:00
notify: [ 'Restart VDR' ]
2017-03-02 16:01:52 +01:00
#+END_SRC
** autoinstall-libcecdaemon
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 21e9641d-17e9-4aaf-aa03-fa593a3864d9
:END:
2017-03-02 16:01:52 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 1edae36a-21b0-4398-9cbf-7a3fee8494b4
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-libcecdaemon/tasks/main.yml :padline no
2017-03-02 16:01:52 +01:00
---
# file roles/autoinstall-libcec-daemon/tasks/main.yml
- name: apt | install libcec-daemon if connected
apt:
name: libcec-daemon
when:
2017-08-31 15:55:04 +02:00
- "2548:1002" in usb
2017-03-02 16:01:52 +01:00
#+END_SRC
** autoinstall-pvr350
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 25622792-622f-4fc1-a2df-e6c6865c5101
:END:
2017-03-02 16:01:52 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 241b4d77-9255-43a7-b816-1fcdf7a3ca77
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-pvr350/tasks/main.yml :padline no
2017-03-02 16:01:52 +01:00
---
# file roles/autoinstall-pvr350/tasks/main.yml
- name: apt | install vdr-plugin-pvr350 if connected
apt:
name: vdr-plugin-pvr350
2017-09-04 12:29:53 +02:00
when: '"0070:4000" in pci'
2017-03-13 19:34:54 +01:00
notify: [ 'Restart VDR' ]
2017-03-02 16:01:52 +01:00
#+END_SRC
2017-07-30 23:33:22 +02:00
** autoinstall-hauppauge-pvr
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4d67e53f-f6ef-4db6-a090-27771b0a2c9e
:END:
2017-07-30 23:33:22 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-hauppauge-pvr/tasks/main.yml :padline no
---
# file roles/autoinstall-hauppauge-pvr/tasks/main.yml
- name: apt | install vdr-plugin-pvrinput if a haupauge pvr card is found
apt:
name: vdr-plugin-pvrinput
2017-09-04 12:29:53 +02:00
when: '"0070:4000" in pci or "4444:0016" in pci'
2017-07-30 23:33:22 +02:00
notify: [ 'Restart VDR' ]
2017-07-30 23:53:19 +02:00
#+END_SRC
2018-01-16 10:07:18 +01:00
** autoinstall-firmware
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 9f0831c2-e713-40b4-af41-04f042067a94
:END:
2018-01-16 12:06:02 +01:00
*** dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 46b8fcd9-bff1-454a-a80b-fcf11fdcaf79
:END:
2018-01-16 12:06:02 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-firmware/meta/main.yml :padline no
---
dependencies:
- { role: collect-facts }
#+END_SRC
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c617b63f-52f6-4650-a6d0-7a56a9494cc8
:END:
2018-01-16 10:07:18 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-firmware/tasks/main.yml :padline no
---
# This role provides easyily downloadable firmware files
2018-08-10 08:13:55 +02:00
- name: Firmware dvb-demod-si2168-b40-01.fw for Hauppauge WinTV HD Solo/Duo, PCTV 292e
2018-01-16 10:07:18 +01:00
get_url:
url: https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-si2168-b40-01.fw
checksum: sha256:8507536630d75a316d0719d6b95c04b90c36baa5b457ad457c9bacadafcef134
dest: /lib/firmware/dvb-demod-si2168-b40-01.fw
when: '"2040:0264" in usb or "2013:025f" in usb'
2018-08-10 08:13:55 +02:00
- name: Firmware dvb-fe-xc5000-1.6.114.fw for Hauppauge WinTV-HVR-930C
2018-01-16 10:07:18 +01:00
get_url:
url: https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-fe-xc5000-1.6.114.fw
checksum: sha256:7104bda8df301fe1bd4c09de1708aeb6d0d8e1f9d55505449fecfad82639235f
dest: /lib/firmware/dvb-fe-xc5000-1.6.114.fw
when: '"2040:1605" in usb'
2018-08-10 08:13:55 +02:00
- name: Firmware ngenge_18.fw for ngene cards
get_url:
url: http://l4m-daten.de/downloads/firmware/dvb-s2/linux/all/ngene_18.fw
checksum: sha256:213d98ec2cd575eba15d82ee79fed7098e670de43792f8aa773a95cfb7c32060
dest: /lib/firmware/ngene_18.fw
when: '"ngene" in modules'
notify: reboot required
- name: Firmware drxk_a3.mc for drxk
get_url:
url: https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/drxk_a3.mc
checksum: sha256:f8956ad6f92a4ce90a6ab94ed23e2f9a27e9317e936fd3e0119778dd28e7e294
dest: /lib/firmware/drxk_a3.mc
when: '"ngene" in modules or "drxk" in modules'
notify: reboot required
2018-01-16 10:07:18 +01:00
#+END_SRC
2017-11-20 09:21:22 +01:00
** autoinstall-dvbsky-firmware
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a50b25e3-46e8-4dea-b247-e1a68237d662
:END:
2018-01-16 12:06:02 +01:00
*** dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 584a050c-d2b6-4443-a645-cf6505835555
:END:
2018-01-16 12:06:02 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbsky-firmware/meta/main.yml :padline no
---
dependencies:
- { role: collect-facts }
#+END_SRC
2017-11-20 09:21:22 +01:00
*** defaults
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: d738074e-9794-49c4-b6ba-e290e1869a02
:END:
2017-11-20 09:21:22 +01:00
#+INCLUDE : "roles/autoinstall-dvbsky-firmware/defaults/main.yml" src yaml
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a40e0ad7-8338-4988-85c2-8fe9eca258e5
:END:
2017-11-20 09:21:22 +01:00
#+INCLUDE : "roles/autoinstall-dvbsky-firmware/tasks/main.yml" src yaml
2017-03-02 16:01:52 +01:00
** TODO autoinstall-dvbhddevice
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: fbce5f86-5946-4f3e-aa9c-86fb0828c0d7
:END:
2017-03-02 16:01:52 +01:00
Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware sollte in yavdr-firmware stecken
2018-01-16 12:06:02 +01:00
*** dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: efd41dfd-bec6-46bc-b19f-2fcb6d626c82
:END:
2018-01-16 12:06:02 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbhddevice/meta/main.yml :padline no
---
dependencies:
- { role: collect-facts }
#+END_SRC
2017-03-02 16:01:52 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: f2e18070-8108-4ae0-bfaa-90e30171852e
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbhddevice/tasks/main.yml :padline no
2017-03-02 16:01:52 +01:00
---
# file roles/autoinstall-dvbhddevice/tasks/main.yml
- name: apt | install vdr-plugin-dvbhddevice if connected
apt:
name: vdr-plugin-dvbhddevice
2017-09-04 12:29:53 +02:00
when: '"13c2:300a" in pci or "13c2:300b" in pci'
2017-03-13 19:34:54 +01:00
notify: [ 'Restart VDR' ]
2017-03-02 16:01:52 +01:00
#+END_SRC
** autoinstall-dvbsddevice
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: fb56a0eb-8586-4e05-8f0d-1154d73f7380
:END:
2018-01-16 12:06:02 +01:00
*** dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 95ebb7f8-d195-4dfc-a8af-3acc2b447906
:END:
2018-01-16 12:06:02 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbsddevice/meta/main.yml :padline no
---
dependencies:
- { role: collect-facts }
#+END_SRC
2017-03-02 16:01:52 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: dbc2734a-f591-4c1a-9870-b1e091f39498
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-dvbsddevice/tasks/main.yml :padline no
2017-03-02 16:01:52 +01:00
---
# file roles/autoinstall-dvbsddevice/tasks/main.yml
2017-11-18 09:06:20 +01:00
# TODO: install firmware
2017-03-02 16:01:52 +01:00
- name: apt | install vdr-plugin-dvbsddevice if module is loaded
apt:
name: vdr-plugin-dvbsddevice
2017-09-04 12:29:53 +02:00
when: '"dvb_ttpci" in modules'
2017-03-13 19:34:54 +01:00
notify: [ 'Restart VDR' ]
2017-03-02 16:01:52 +01:00
#+END_SRC
2017-11-13 09:46:51 +01:00
** autoinstall-hardware-irmp
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 2115f9dc-5bc9-4d97-b568-d9c8c855b86e
:END:
2018-01-16 12:06:02 +01:00
*** dependencies
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e8f14ffb-012f-4e4a-b57c-7b99d49c43c4
:END:
2018-01-16 12:06:02 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-hardware-irmp/meta/main.yml :padline no
---
dependencies:
- { role: collect-facts }
#+END_SRC
2017-11-13 09:46:51 +01:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: d9dbbd24-a324-4200-8d8e-a2d395921702
:END:
2017-11-13 09:46:51 +01:00
#+BEGIN_SRC yaml :tangle roles/autoinstall-hardware-irmp/tasks/main.yml :padline no
---
# file roles/autoinstall-hardware-irmp/tasks/main.yml
- name: apt | install yavdr-hardware-irmp if connected
apt:
name: yavdr-hardware-irmp
2017-11-20 09:45:15 +01:00
state: present
2018-01-21 12:20:13 +01:00
when: '"1209:4444" in usb or "16c0:27d9" in usb'
2017-11-13 09:46:51 +01:00
#+END_SRC
2019-01-01 23:48:31 +01:00
** Serial IR Receivers
2019-01-02 09:26:56 +01:00
This role preconfigures the system for serial "homebrew" receivers. Newer kernel versions provide ~serial_ir~ which acts as a rc-core driver, so we don't need lircd - eventlircd can use the device directly.
2019-01-01 23:48:31 +01:00
2019-01-02 09:26:56 +01:00
As configured in the role yavdr-remote ([[*create /etc/rc_maps.cfg ][/etc/rc_maps.cfg ]]) a keytable for a RC-6 MCE remote is loaded by default. You can choose a different keymap which may also use another ir-protocol.
2019-01-01 23:48:31 +01:00
*** defaults
#+BEGIN_SRC yaml :tangle roles/serial-ir/defaults/main.yml
2019-01-02 12:08:37 +01:00
---
# file: roles/serial-ir/defaults/main.yml
2019-01-02 09:26:56 +01:00
serial_ir_device: ttyS0
2019-01-01 23:48:31 +01:00
#+END_SRC
*** tasks
#+BEGIN_SRC yaml :tangle roles/serial-ir/tasks/main.yml
---
2019-01-02 12:08:37 +01:00
# file: roles/serial-ir/tasks/main.yml
2019-01-01 23:48:31 +01:00
- name: apt | install setserial
apt:
name: setserial
- name: load serial_ir on startup
template:
2019-01-02 10:22:52 +01:00
src: roles/serial-ir/templates/modules-load.d/serial_ir.conf.j2
2019-01-01 23:48:31 +01:00
dest: /etc/modules-load.d/serial_ir.conf
- name: serial_ir module options
template:
2019-01-02 10:22:52 +01:00
src: roles/serial-ir/templates/modprobe.d/serial_ir.conf.j2
2019-01-02 10:13:18 +01:00
dest: /etc/modprobe.d/serial_ir.conf
2019-01-01 23:48:31 +01:00
- name: setserial options
template:
2019-01-02 10:22:52 +01:00
src: roles/serial-ir/templates/serial.conf.j2
2019-01-01 23:48:31 +01:00
dest: /etc/serial.conf
#+END_SRC
*** templates
**** load serial_ir on startup
2019-01-02 12:08:37 +01:00
#+BEGIN_SRC jinja2 :tangle roles/serial-ir/templates/modules-load.d/serial_ir.conf.j2
{{ ansible_managed | comment }}
2019-01-01 23:48:31 +01:00
serial_ir
#+END_SRC
**** serial_ir module options
#+BEGIN_SRC jinja2 :tangle roles/serial-ir/templates/modprobe.d/serial_ir.conf.j2
2019-01-02 12:08:37 +01:00
{{ ansible_managed | comment }}
2019-01-02 09:26:56 +01:00
{% if serial_ir_device == "ttyS0" %}
2019-01-02 12:08:37 +01:00
#COM1 equivalent, /dev/ttyS0
2019-01-01 23:48:31 +01:00
options serial_ir irq=4 io=0x3f8
2019-01-02 09:26:56 +01:00
{% elif serial_ir_device == "ttyS1" %}
2019-01-01 23:48:31 +01:00
#COM2 equivalent, /dev/ttyS1
options serial_ir irq=3 io=0x2f8
{% endif %}
2019-01-02 12:08:37 +01:00
{% if serial_ir_device in ("ttyS0", "ttyS1") %}
2019-01-02 09:26:56 +01:00
install serial_ir setserial /dev/ {{serial_ir_device}} uart none; /sbin/modprobe --ignore-install serial_ir
2019-01-02 12:08:37 +01:00
{% endif %}
2019-01-01 23:48:31 +01:00
#+END_SRC
**** setserial options
#+BEGIN_SRC jinja2 :tangle roles/serial-ir/templates/serial.conf.j2
2019-01-02 12:08:37 +01:00
{{ ansible_managed | comment }}
2019-01-02 09:26:56 +01:00
{% if serial_ir_device == "ttyS0" %}
2019-01-01 23:48:31 +01:00
#COM1 equivalent, /dev/ttyS0
/dev/ttyS0 uart none
2019-01-02 09:26:56 +01:00
{% elif serial_ir_device == "ttyS1" %}
2019-01-01 23:48:31 +01:00
#COM2 equivalent, /dev/ttyS1
/dev/ttyS1 uart none
{% endif %}
#+END_SRC
2017-06-20 15:09:15 +02:00
** kodi
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a0f42636-e0ec-4904-a6f9-48f714a2052b
:END:
2017-06-20 15:09:15 +02:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 2c9ac888-09d3-4ab7-bba0-565f10d8277b
:END:
2017-06-20 15:09:15 +02:00
**** Install KODI
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 01b0cb56-1733-41c0-90c5-ccae23abc530
:END:
2017-11-04 15:24:09 +01:00
***** main.yml
:PROPERTIES:
:UNNUMBERED: t
2018-09-20 09:00:22 +02:00
:ID: 1ff3267c-0036-471d-9f79-d1edda353789
2017-11-04 15:24:09 +01:00
:END:
#+INCLUDE : "roles/kodi/tasks/main.yml" src yaml
***** install-kodi.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 52ac7380-3ea8-4eaf-a4b6-7921d1277621
:END:
2017-11-04 15:24:09 +01:00
#+INCLUDE : "roles/kodi/tasks/install-kodi.yml" src yaml
***** configure-kodi.yml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 7ba78b23-6aa6-4d6c-a58a-ed5a8d9c5e62
:END:
2017-11-04 15:24:09 +01:00
#+INCLUDE : "roles/kodi/tasks/configure-kodi.yml" src yaml
2017-06-20 15:09:15 +02:00
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 14d5d302-7dc3-4603-95ff-9d09bd147d18
:END:
2017-06-20 15:09:15 +02:00
**** kodi.service
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 32046abe-8b1c-4858-ba01-79fa5bc0581f
:END:
2017-11-04 15:24:09 +01:00
This systemd unit for the user session starts (and stops) kodi.
#+INCLUDE : "roles/kodi/templates/kodi.service.j2" src conf
2017-06-20 15:09:15 +02:00
2017-07-08 13:37:35 +02:00
*** files
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 58c5c693-bd24-420a-bfed-79771e8e0d47
:END:
2017-11-04 15:24:09 +01:00
Those configuration files provide a preconfiguration for kodi which overrides the system wide configuration
2017-07-08 13:37:35 +02:00
**** Lircmap.xml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0696708c-2d66-41bb-9564-51692b9d343e
:END:
2017-11-04 15:24:09 +01:00
This file allows to map keys sent by remotes via eventlircd (which uses the name ~devinput~ ) to kodi key names.
#+INCLUDE : "roles/kodi/files/userdata/Lircmap.xml" src nxml
2017-07-08 13:37:35 +02:00
**** keymaps
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 1033979f-55e7-44da-82ff-a307a3415572
:END:
2017-11-04 15:24:09 +01:00
This file maps the keys defined in Lircmap.xml to actions within kodi.
2017-07-08 13:37:35 +02:00
***** remote.xml
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: cffe42cf-9e03-4f7a-85f5-874a2badae80
:END:
2017-11-04 15:24:09 +01:00
#+INCLUDE : "roles/kodi/files/userdata/keymaps/remote.xml" src xml
2017-07-15 14:28:23 +02:00
** dvd
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 07af4201-bbf4-4c69-8ffa-7a7493e5f75d
:END:
2017-07-15 14:28:23 +02:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 75a94df1-f19f-40d2-bca0-2fa3a0c6e8dc
:END:
2017-07-15 14:28:23 +02:00
**** install libdvd-pkg, allow programs to eject optical media
2017-11-04 15:24:09 +01:00
:PROPERTIES:
:UNNUMBERED: t
2018-09-20 09:00:22 +02:00
:ID: 7e7f26cf-073d-4d1c-8f6e-cc69de259aaf
2017-11-04 15:24:09 +01:00
:END:
#+INCLUDE : "roles/dvd/tasks/main.yml" src yaml
2018-03-25 13:09:54 +02:00
** install-sundtek
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: de68c6d2-92c7-47c2-9d28-bfa6be00ec3e
:END:
2018-03-25 13:09:54 +02:00
*** variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: bab04ad5-86b1-4953-a87e-bb6bfa9e5d0c
:END:
2018-03-25 13:09:54 +02:00
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: f06b2ce3-e6c0-41d7-809a-12d869525a11
:END:
2018-03-25 13:09:54 +02:00
#+BEGIN_SRC yaml :tangle roles/install-sundtek/tasks/main.yml :padline no
---
# file roles/install-sundtek/tasks/main.yml
- name: apt | install yavdr-hardware-sundtek
apt:
name: yavdr-hardware-sundtek
# TODO: include LD_PRELOAD in yavdr-hardware-sundtek!
#- name: set LD_PRELOAD for sundtek driver to VDR's environment
# file:
# src: files/sundtek_LD_PRELOAD.conf
# dest: /etc/systemd/system/vdr.service.d/sundtek_LD_PRELOAD.conf
- name: systemd | start sundtek.service
systemd:
name: sundtek.service
state: started
enabled: yes
masked: no
daemon-reload: yes
- name: detect local and remote sundtek devices
command: scansundtek
register: sundtek_scan
- name: set variable sundtek_scan
set_fact:
sundtek_devices: "{{ sundtek_scan.stdout | from_json }}"
- name: create /etc/sundtek.conf
template:
src: templates/sundtek.conf.j2
dest: /etc/sundtek.conf
notify: Restart sundtek.service
- name: systemd | start sundtek-avahi-mounter.service
systemd:
name: sundtek-avahi-mounter.service
state: started
masked: no
enabled: yes
daemon-reload: yes
#+END_SRC
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 30011bae-7869-4928-b8ea-b66034badf9e
:END:
2019-01-02 17:16:11 +01:00
**** Overrides for systemd unit sundtek.service
- [ ] wait for network
- [X] wait for local devices (see sundtek.service)
**** /etc/systemd/system/sundtek.service
#+BEGIN_SRC systemd :tangle roles/sundtek/systemd/sundtek.service.j2
{{ ansible_managed | comment }}
[Unit]
Description=Sundtek mediasrv
After=network-online.target
Before=vdr.service
[Service]
Type=forking
ExecStart=/opt/bin/mediasrv -d --pluginpath= /opt/bin --wait-for-devices
ExecStop=/opt/bin/mediaclient --shutdown
[Install]
WantedBy=multi-user.target
#+END_SRC
2018-09-20 08:56:38 +02:00
**** /etc/sundtek.conf
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 73609a51-8209-47c2-82a0-48838f47b884
:END:
2018-03-25 13:09:54 +02:00
#+BEGIN_SRC conf
# ----- GLOBAL SECTION -----
#Set loglevel for logging to /var/log/mediasrv.log
#autoupdate=[on|off] #enable automatic driver update, default off
autoupdate=off
#loglevel=[off|min|full] #default: off
#max .. little bit more
loglevel=off
#pluginpath=/path/to/drivers #set path to drivers
#dvb_api_version=x.y #default API version will be parsed from
#/usr/include/linux/dvb/version.h, if no such file is
2018-09-20 08:55:00 +02:00
#available the latest internally supported API ::version will be
2018-03-25 13:09:54 +02:00
#used (which will be quite new)
#audio_skip_bytes=N #when changing analogTV channels,
#skip N bytes to suppress audio noise
#bulk_notification[on|off] #default off, bulk_notification will only trigger device_attach once
#after the the first device scan when the driver is started up
#after this first scan, the notification will be triggered
#normally again for each device.
#
#for example when 2 devices are attached to the system only one
#notification will be triggered initially, any at a later time
#attached device will generate another device_attach notification
#by default each device will call the script which is set up with
#device_attach
#use_tvvideo=[on|off] #use /dev/tvvideoN instead of /dev/video
#this works around a new Adobe Flash bug in 2012, where flash crashes
#if files (/dev/videoN) other than /dev/video0 are available
#use_hwpidfilter=[on|off] #For DVB-C, DVB-T, DVB-S/S2
#enable PID filter, please be careful with that, there are only 15 HW Pid filters available
#when more than 15 pids are set up the pid filter will be disabled automatically
#dmhwpidfilter=[on|off] #default on, in some cases off might be useful to disable hw pid filter for settopboxes
#if you get a black image when capturing a TV channel and watching another channel on the
#same transponder - try this option and reboot
#usb_transaction_delay=[0-20] #throttle the USB setup transactions, this can solve problems with weak USB stacks for
#example for embedded boards, unit is milliseconds
#usb_timeout=[0 - N] #USB timeout for each transaction in milliseconds, 0 default infinite
#voltage_tone_off=[1 or 0] #0 .. default, normal behaviour
#1 .. force DVB-S/S2 to not use any Voltage or Tone (ignore any user parameters)
#ir_disabled=[1 or 0] #0 .. enable remote control polling, the driver will permanently check for remote control keys
#1 .. disable remote control polling, might fix bugs with weak USB stacks on embedded boards
#
#Enable listening on network
#enablenetwork=[on|off] #default: off
#Lowest adapter number to start with, e.g. /dev/dvb/adapter5/frontend0
#first_adapter=5
#Call attach script when new device appears
#device_attach=[PATH_TO_SCRIPT] [PARAMETER|DEVID] #"DEVID" will automatically be replaced with the device ID
device_attach=/usr/bin/sundtek_attach
#Call detach script when device disappears
#device_detach=[PATH_TO_SCRIPT] [PARAMETER|DEVID] #"DEVID" will automatically be replaced with the device ID
device_detach=/usr/bin/sundtek_detach
{% for device in sundtek_devices.local %}
{% if device.serial is defined %}
[{{ device.serial }}]
#Infrared protocol to use
#ir_protocol=[RC5|NEC|RC6] #default: NEC
{% if device.ir_protocol|default("") %}
ir_protocol={{ device.ir_protocol }}
{% endif %}
#Keymap to use, e.g. "/lib/udev/rc_keymaps/vp702x"
#rcmap=[PATH_TO_KEYMAP] #default: keymap which comes with the device
{% if device.rcmap|default("") %}
rcmap={{ device.rcmap }}
{% endif %}
#Choose initial DVB mode for hybrid DVB-T/DVB-C devices only
#initial_dvb_mode=[DVBC|DVBT]
{% if device.initial_dvb_mode|default("") %}
initial_dvb_mode={{ device.dvb_mode }}
{% endif %}
#Call attach script when new device appears
#device_attach=[PATH_TO_SCRIPT] [PARAMETER|DEVID] #"DEVID" will automatically be replaced with the device ID
device_attach=/usr/bin/sundtek_attach
#Call detach script when device disappears
#device_detach=[PATH_TO_SCRIPT] [PARAMETER|DEVID] #"DEVID" will automatically be replaced with the device ID
device_detach=/usr/bin/sundtek_detach
{% if device.capabilites.analog_tv %}
disable_analogtv=1 #disable initialization of analogTV Frontend
{% endif %}
{% endif %}
{% endfor %}
#+END_SRC
2017-03-03 10:39:59 +01:00
** template-test
2017-11-04 15:24:09 +01:00
:PROPERTIES:
:EXPORT: nil
2018-09-20 09:00:22 +02:00
:ID: d2bd49d0-734d-48ea-aa85-1885a6176cd3
2017-11-04 15:24:09 +01:00
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml :padline no
2017-03-03 10:39:59 +01:00
---
2017-06-21 12:46:51 +02:00
2017-03-03 10:39:59 +01:00
- name: show vars
debug:
var: '{{ system }}'
- name: test templates
template:
src: templates/test.j2
dest: /tmp/test.txt
#+END_SRC
2017-05-18 16:06:31 +02:00
#+BEGIN_SRC shell :tangle roles/template-test/templates/xorg.conf_test.j2
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2017-03-03 10:39:59 +01:00
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
{% if system.x11.dualhead.enabled %}
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
2017-05-18 16:06:31 +02:00
# 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
2017-03-03 10:39:59 +01:00
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
{% 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 system.x11.dualhead.enabled == "1" %}
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 %}
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 system.x11.dualhead.enabled == "1" %}
Section "Device"
Identifier "Device1"
{% if system.hardware.nvidia.detected %}
Driver "nvidia"
VendorName "NVIDIA Corporation"
{% endif %}
Screen 1
{% if 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 system.x11.display.0.default is defined and system.x11.display.0.default %}
Modes "{{ system.x11.display.0.default }}"{% for mode in system.x11.display.0.mode %}{% if mode != system.x11.display.0.default %} "{{ mode }}"{% endif %}{% endfor %}
{% elif system.hardware.nvidia.detected == 1 %}
Modes "nvidia-auto-select"
{% endif %}
EndSubSection
{% if system.x11.display.0.default or system.x11.default %}
2019-01-05 11:42:26 +01:00
{% if system.x11.display.0.device is defined and system.x11.display.0.device %}
2017-03-13 10:40:35 +01:00
Option "ConnectedMonitor" {{ system.x11.display.0.device }}
{% else %}
Option "ConnectedMonitor" {{ system.x11.default }}
{% endif %}
# Option "ConnectedMonitor" "<?cs if:(?system.x11.display.0.device) ? ><?cs call:fix_display_name(system.x11.display.0.device) ? ><?cs else ? ><?cs var:system.x11.default ? ><?cs /if ? ><?cs if:(?system.x11.dualhead.enabled && system.x11.dualhead.enabled == 1) ? >, <?cs call:fix_display_name(system.x11.display.1.device) ? ><?cs /if ? >"
#Option "ConnectedMonitor"
"<?cs if:(?system.x11.display.0.device) ? >
<?cs call:fix_display_name(system.x11.display.0.device) ? >
<?cs else ? >
<?cs var:system.x11.default ? >
<?cs /if ? >
<?cs if:(?system.x11.dualhead.enabled && system.x11.dualhead.enabled == 1) ? >, <?cs call:fix_display_name(system.x11.display.1.device) ? ><?cs /if ? >"
2017-03-03 10:39:59 +01:00
# Option "UseDisplayDevice" "<?cs if:(?system.x11.display.0.device) ?><?cs call:fix_display_name(system.x11.display.0.device) ?><?cs else ?><?cs var:system.x11.default ?><?cs /if ?>"
# <?cs /if ?>
# <?cs if:(?system.hardware.nvidia.0.edid && system.hardware.nvidia.0.edid == "1") ?>
# Option "CustomEDID" "<?cs call:fix_display_name(system.x11.display.0.device) ?>:/etc/X11/edid.0.yavdr"
# <?cs /if ?>
# <?cs if:(system.hardware.nvidia.detected == 1 && ?system.x11.display.0.device) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.0.device) ?>: <?cs var:system.x11.display.0.default ?> { ViewPortIn=<?cs var:system.x11.display.0.viewport.in.x ?>x<?cs var:system.x11.display.0.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.0.viewport.out.x ?>x<?cs var:system.x11.display.0.viewport.out.y ?>+<?cs var:system.x11.display.0.viewport.out.plusx ?>+<?cs var:system.x11.display.0.viewport.out.plusy ?> }"
# <?cs each:mode = system.x11.display.0.mode ?><?cs if:(mode != system.x11.display.0.default) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.0.device) ?>: <?cs var:mode ?> { ViewPortIn=<?cs var:system.x11.display.0.viewport.in.x ?>x<?cs var:system.x11.display.0.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.0.viewport.out.x ?>x<?cs var:system.x11.display.0.viewport.out.y ?>+<?cs var:system.x11.display.0.viewport.out.plusx ?>+<?cs var:system.x11.display.0.viewport.out.plusy ?> }"<?cs /if ?><?cs /each ?>
{% 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
# <?cs if:(?system.x11.display.1.default && system.x11.display.1.default != "" && system.x11.display.1.default != "disabled") ?>
# Option "UseDisplayDevice" "<?cs call:fix_display_name(system.x11.display.1.device) ?>"
# <?cs /if ?>
# <?cs if:(?system.hardware.nvidia.1.edid && system.hardware.nvidia.1.edid == "1") ?>
# Option "CustomEDID" "<?cs call:fix_display_name(system.x11.display.1.device) ?>:/etc/X11/edid.1.yavdr"
# <?cs /if ?>
# <?cs if:(system.hardware.nvidia.detected == 1 && ?system.x11.display.1.device) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.1.device) ?>: <?cs var:system.x11.display.1.default ?> { ViewPortIn=<?cs var:system.x11.display.1.viewport.in.x ?>x<?cs var:system.x11.display.1.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.1.viewport.out.x ?>x<?cs var:system.x11.display.1.viewport.out.y ?>+<?cs var:system.x11.display.1.viewport.out.plusx ?>+<?cs var:system.x11.display.1.viewport.out.plusy ?> }"
# <?cs each:mode = system.x11.display.1.mode ?><?cs if:(mode != system.x11.display.1.default) ?>
# Option "MetaModes" "<?cs call:fix_display_name(system.x11.display.1.device) ?>: <?cs var:mode ?> { ViewPortIn=<?cs var:system.x11.display.1.viewport.in.x ?>x<?cs var:system.x11.display.1.viewport.in.y ?>, ViewPortOut=<?cs var:system.x11.display.1.viewport.out.x ?>x<?cs var:system.x11.display.1.viewport.out.y ?>+<?cs var:system.x11.display.1.viewport.out.plusx ?>+<?cs var:system.x11.display.1.viewport.out.plusy ?> }"<?cs /if ?><?cs /each ?>
# <?cs /if ?>
EndSection
{% endif %}
2017-05-18 16:06:31 +02:00
{% if not system.x11.use_compositing %}
2017-03-03 10:39:59 +01:00
Section "Extensions"
2017-05-18 16:06:31 +02:00
# if not open-gl OSD is needed (e.g. for vdr-sxfe):
2017-03-03 10:39:59 +01:00
Option "Composite" "Disable"
EndSection
2017-05-18 16:06:31 +02:00
{% endif %}
2017-03-03 10:39:59 +01:00
#+END_SRC
#+BEGIN_SRC yaml :tangle roles/template-test/defaults/main.yml
foo:
- bar
- baz
- spam
system:
hardware:
nvidia:
detected: "1"
busid: "000:2304:234"
x11:
dualhead:
enabled: "0"
display:
0:
mode:
- "1920x1080_50"
default: "nvidia-auto"
1:
mode:
- "1280x720_60"
#+END_SRC
2017-11-20 09:45:15 +01:00
** wakeup
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 7c91863a-167a-47da-bfdb-c93f3846aee6
:END:
2017-11-20 09:45:15 +01:00
*** defaults
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 0cfc6c58-fbcd-47c9-ad44-7b6484e054a8
:END:
2017-11-20 09:45:15 +01:00
#+BEGIN_SRC yaml :tangle roles/wakeup/defaults/main.yml :padline no
---
# file roles/wakeup/defaults/main.yml
wakeup_method: "acpiwakeup"
#+END_SRC
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 213938be-87c0-46b2-bbea-081d49d0758c
:END:
2017-11-20 09:45:15 +01:00
#+BEGIN_SRC yaml :tangle roles/wakeup/tasks/main.yml :padline no
---
# file roles/wakeup/tasks/main.yml
- name: install and configure vdr-addon-acpiwakeup
2017-11-20 11:54:11 +01:00
apt:
name: vdr-addon-acpiwakeup
state: present
when: wakeup_method == "acpiwakeup"
2017-11-20 09:45:15 +01:00
2017-11-20 11:54:11 +01:00
- name: expand template for /etc/vdr/vdr-addon-acpiwakeup.conf
template:
2017-11-20 12:01:02 +01:00
src: templates/vdr-addon-acpiwakeup.conf.j2
2017-11-20 11:54:11 +01:00
dest: /etc/vdr/vdr-addon-acpiwakeup.conf
2017-11-20 09:45:15 +01:00
#+END_SRC
2017-11-20 11:54:11 +01:00
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 1ef541bf-540c-468c-a236-9599f44f8cef
:END:
2017-11-20 11:54:11 +01:00
#+BEGIN_SRC jinja2 :tangle roles/wakeup/templates/vdr-addon-acpiwakeup.conf.j2 :padline no
2018-01-16 13:07:01 +01:00
{{ ansible_managed | comment }}
2017-11-20 11:54:11 +01:00
# Activate/deactivate ACPIWakeup with yes/no:
ACPI_ENABLED="{% if wakeup_method = = 'acpiwakeup' %}yes{% else %}no{% endif %}"
# How many minutes should the machine wake up before the timer starts:
ACPI_START_AHEAD=5
# If you want your VDR machine to wakeup in regular intervals (i.e. for
# updating EPG data), specify the days of the week and the wakeup time.
#
# Days of the week for regular wakeup (not set=Disabled, 1=Monday...7=Sunday)
# ACPI_REGULAR_DAYS="1 2 3 4 5 6 7"
# Wakeup time
#ACPI_REGULAR_TIME=01:00 # HH:MM
#+END_SRC
2017-03-13 22:25:32 +01:00
** grub-config
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 20b99618-5cda-4bd2-94d8-ff401e3cdaa3
:END:
2017-03-13 22:25:32 +01:00
*** default variables
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: c1046581-bb7d-438d-8074-8ed243c7ffe9
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/grub-config/defaults/main.yml :mkdirp yes :padline no
2017-03-13 22:25:32 +01:00
system:
shutdown: poweroff
grub:
timeout: 0
boot_options: quiet nosplash
#+END_SRC
*** tasks
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: a846c074-3267-4c42-a573-f5f435364929
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/grub-config/tasks/main.yml :mkdirp yes :padline no
---
2017-03-13 22:25:32 +01:00
- name: custom grub configuration for timeout and reboot halt
template:
src: templates/50_custom.j2
dest: /etc/grub.d/50_custom
mode: '0775'
notify: [ 'Update GRUB' ]
# TODO: add special case if plymouth is used
- name: let the system boot quietly
lineinfile:
dest: /etc/default/grub
state: present
regexp: '^(GRUB_CMDLINE_LINUX_DEFAULT=")'
line: '\1{{ grub.boot_options}}"'
backrefs: yes
notify: [ 'Update GRUB' ]
#+END_SRC
*** templates
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: b6b30fe9-27b4-4713-8a0d-56d4ef1919d4
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC shell :tangle roles/grub-config/templates/50_custom.j2 :mkdirp yes :padline no
2017-03-13 22:25:32 +01:00
#!/bin/sh
exec tail -n +3 $0
# This file is configured by the ansible configuration for yaVDR
{% if system.shutdown is defined and system.shutdown == 'reboot' %}
menuentry "PowerOff" {
halt
}
{% endif %}
if [ "${recordfail}" = 1 ]; then
set timeout={{ 3 if grub.timeout < 3 else grub.timeout }}
else
set timeout={{ grub.timeout if grub.timeout is defined else 0 }}
fi
#+END_SRC
*** handlers
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 3ca84eb3-cc43-4353-a6b3-3acda9d221fc
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC yaml :tangle roles/grub-config/handlers/main.yml :mkdirp yes :padline no
---
2018-06-06 07:51:07 +02:00
- name: Update Initramfs
command: "update-initramfs -u"
failed_when: ('error' in initramfs_register_update.stderr)
register: initramfs_register_update
2017-03-13 22:25:32 +01:00
- name: Update GRUB
command: update-grub
failed_when: ('error' in grub_register_update.stderr)
register: grub_register_update
# TODO: Do we need to use grub-set-default?
# https://github.com/yavdr/yavdr-utils/blob/master/events/actions/update-grub
#+END_SRC
2017-03-03 10:39:59 +01:00
* Modules
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 4d68c2cf-dfcb-4f42-820c-1f305afa17a7
:END:
2017-03-03 10:39:59 +01:00
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
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e6ed071a-b2eb-4280-a78e-8986b3bf5c4a
:END:
2018-08-10 08:59:46 +02:00
#+BEGIN_SRC python :tangle library/hardware_facts.py :shebang "#!/usr/bin/env python"
2017-03-03 10:39:59 +01:00
# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules.
DOCUMENTATION = '''
2017-06-20 15:09:15 +02:00
---
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
2017-03-03 10:39:59 +01:00
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
gpus:
required: False
default: True
description:
- return a list of devices of the pci gpu class (0x030000)
2017-11-20 09:21:22 +01:00
acpi_power_modes:
required: False
default: True
description:
- return a list of supported acpi power saving modes
2017-03-03 10:39:59 +01:00
notes:
- requres python-pyusb and python-kmodpy
requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de >"
'''
EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True
pci: True
modules: True
2017-11-20 09:21:22 +01:00
acpi_power_modes: True
2017-03-03 10:39:59 +01:00
- debug:
var: usb
2017-11-21 11:30:03 +01:00
- debug:
2017-03-03 10:39:59 +01:00
var: pci
2017-11-21 11:30:03 +01:00
- debug:
2017-03-03 10:39:59 +01:00
var: modules
2017-11-21 11:30:03 +01:00
- debug:
2017-03-03 10:39:59 +01:00
var: gpus
'''
import glob
import json
import os
import sys
import usb.core
from collections import namedtuple
2018-04-20 11:47:18 +02:00
from itertools import chain
2017-03-03 10:39:59 +01:00
import kmodpy
from ansible.module_utils.basic import *
2017-06-20 16:38:38 +02:00
PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath')
2017-07-16 08:03:50 +02:00
vendor_dict = {
0x10de: 'nvidia',
0x8086: 'intel',
0x1002: 'amd',
0x80ee: 'virtualbox',
}
2017-03-03 10:39:59 +01:00
def get_pci_devices():
2018-04-20 11:47:18 +02:00
for device in chain(glob.glob('/sys/devices/pci*/ *:*:*/'), glob.glob('/sys/devices/pci* /*:*:*/ *:*:*/')):
2017-07-16 08:03:50 +02:00
try:
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)
except IOError:
pass
2017-03-03 10:39:59 +01:00
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:
2017-07-16 08:16:55 +02:00
yield {"VendorName": vendor_dict.get(d.idVendor, "unknown"),
"VendorID": d.idVendor, "ProductID": d.idProduct}
2017-03-03 10:39:59 +01:00
return [entry for entry in get_entries(iterator)]
2017-11-20 09:21:22 +01:00
def list_acpi_power_modes():
acpi_power_modes = []
try:
with open('/sys/power/state') as f:
acpi_power_modes = [l for l in f.readline().split()]
except IOError:
pass
return acpi_power_modes
2017-03-03 10:39:59 +01:00
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),
2017-11-20 09:21:22 +01:00
'acpi_power_modes': dict(default=True, type= 'bool', required=False),
2017-03-03 10:39:59 +01:00
}
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']
2017-11-20 09:21:22 +01:00
collect_acpi_power_modes = module.params['acpi_power_modes']
usb_devices = []
pci_devices = []
modules = []
gpus = []
2017-11-22 09:24:33 +01:00
nvidia_detected = False
intel_detected = False
amd_detected = False
virtualbox_detected = False
2017-11-20 09:21:22 +01:00
acpi_power_modes = []
2017-03-03 10:39:59 +01:00
if collect_usb:
usb_devices = format_device_list(usb.core.find(find_all=True))
2017-11-20 09:21:22 +01:00
2017-03-03 10:39:59 +01:00
if collect_pci:
pci_devices = format_device_list(get_pci_devices())
2017-11-20 09:21:22 +01:00
2017-03-03 10:39:59 +01:00
if collect_modules:
k = kmodpy.Kmod()
modules = [m[0] for m in k.loaded()]
2017-11-20 09:21:22 +01:00
2017-03-03 10:39:59 +01:00
if collect_gpus:
gpus = format_gpu_device_list(get_pci_devices())
2017-11-22 09:26:32 +01:00
nvidia_detected = any((True for gpu in gpus if gpu['VendorName'] = = 'nvidia'))
intel_detected = any((True for gpu in gpus if gpu['VendorName'] = = 'intel'))
amd_detected = any((True for gpu in gpus if gpu['VendorName'] = = 'amd'))
virtualbox_detected = any((True for gpu in gpus if gpu['VendorName'] = = 'virtualbox'))
2017-11-20 09:21:22 +01:00
if collect_acpi_power_modes:
acpi_power_modes = list_acpi_power_modes()
data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus,
2017-11-22 09:24:33 +01:00
'acpi_power_modes': acpi_power_modes, 'nvidia_detected': nvidia_detected,
'intel_detected': intel_detected, 'amd_detected': amd_detected,
'virtualbox_detected': virtualbox_detected}
2017-03-03 10:39:59 +01:00
module.exit_json(changed=False, ansible_facts=data, msg=data)
if __name__ == '__main__':
main()
#+END_SRC
2018-08-10 09:01:53 +02:00
** pci_facts.py
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: b878d43c-8111-4db0-9ce9-d495040fb564
:END:
2018-08-10 09:01:53 +02:00
#+BEGIN_SRC python :tangle library/pci_facts.py :shebang "#!/usr/bin/env python"
# This module parses the output of lspci for detailed information about available (sub) devices.
DOCUMENTATION = '''
---
module: pci_facts
short_description: parses lspci output for detailed (sub) devices data
description:
- This module parses the output of lspci for detailed information about available (sub) devices.
- returns a list with a dict for each device
notes:
- requires lspci (package pciutils)
'''
EXAMPLES = '''
- name: get detailled pci device infos
pci_facts:
- debug:
var: pci_devices
'''
import argparse
import shlex
import subprocess
from collections import namedtuple
from ansible.module_utils.basic import *
def convert2hex(arg):
arg = arg.strip('"')
if arg:
return int(arg, 16)
else:
return None
def parse_lspci_data():
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--revision', help='revision', type=convert2hex)
parser.add_argument('-p', '--progif', help='proginf', type=convert2hex)
parser.add_argument('slot')
parser.add_argument('device_class', type=convert2hex)
parser.add_argument('vendor_id', type=convert2hex)
parser.add_argument('device_id', type=convert2hex)
parser.add_argument('sub_vendor_id', type=convert2hex)
parser.add_argument('sub_device_id', type=convert2hex)
parser.add_argument('other', nargs='*', default= [])
devices = []
for line in subprocess.check_output(['lspci', '-nm'], universal_newlines=True).splitlines():
args = parser.parse_args(args=shlex.split(line))
devices.append(vars(args))
return devices
def main():
arg_specs = {}
module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,)
try:
pci_devices = parse_lspci_data()
except:
module.fail_json(msg="Something fatal happened")
data = {'pci_devices': pci_devices}
module.exit_json(changed=False, ansible_facts=data, msg=data)
if __name__ == '__main__':
main()
#+END_SRC
2017-03-03 10:39:59 +01:00
** satip_facts.py
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: 2dbd3ae5-4352-4fd7-9b91-337816559331
:END:
2017-06-21 12:46:51 +02:00
#+BEGIN_SRC python :tangle library/satip_facts.py :shebang #!/usr/bin/env python2
2017-03-03 10:39:59 +01:00
DOCUMENTATION = '''
---
module: hardware_facts
short_description: "check if at least one SAT>IP server responds on the network"
description:
- This script sends a multicast message and awaits responses by Sat>IP servers.
2017-09-04 12:29:53 +02:00
Returns a list of detected SAT>IP servers with their name and capabilites.
2017-03-03 10:39:59 +01:00
'''
EXAMPLES = '''
- name: "detect SAT>IP Server on the network"
action: satip_facts
- debug:
2017-09-04 12:29:53 +02:00
var: satip_devices
2017-03-03 10:39:59 +01:00
'''
import json
import socket
import sys
import time
2017-09-04 12:29:53 +02:00
import xml.etree.ElementTree as ET
import requests
from contextlib import contextmanager
2017-03-03 10:39:59 +01:00
from ansible.module_utils.basic import *
2017-09-04 12:29:53 +02:00
SSDP_BIND = "0.0.0.0"
2017-03-03 10:39:59 +01:00
SSDP_ADDR = "239.255.255.250"
SSDP_PORT = 1900
# SSDP_MX = max delay for server response
# a value of 2s is recommended by the SAT>IP specification 1.2.2
SSDP_MX = 2
SSDP_ST = "urn:ses-com:device:SatIPServer:1"
ssdpRequest = "\r\n".join((
"M-SEARCH * HTTP/1.1",
"HOST: %s:%d" % (SSDP_ADDR, SSDP_PORT),
"MAN: \"ssdp:discover\"",
"MX: %d" % (SSDP_MX),
"ST: %s" % (SSDP_ST),
"\r\n"))
2017-09-04 12:29:53 +02:00
@contextmanager
def socket_manager(*args, **kwargs):
"""provide a context manager for socket"""
sock = socket.socket(*args, **kwargs)
sock.setblocking(False)
2017-03-03 10:39:59 +01:00
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
2017-09-04 12:29:53 +02:00
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except socket.error:
pass
2017-03-03 10:39:59 +01:00
sock.settimeout(SSDP_MX + 0.5)
2017-09-04 12:29:53 +02:00
sock.bind((SSDP_BIND, SSDP_PORT))
2017-03-03 10:39:59 +01:00
try:
2017-09-04 12:29:53 +02:00
yield sock
finally:
sock.close()
def parse_satip_xml(data):
""" Parse SAT>IP XML data.
Args:
data (str): XML input data..
Returns:
dict: Parsed SAT>IP device name and frontend information.
"""
result = {'name': '', 'frontends': {}}
if data:
root = ET.fromstring(data)
name = root.find('.//*/ {urn:schemas-upnp-org:device-1-0}friendlyName')
result['name'] = name.text
satipcap = root.find('.//*/ {urn:ses-com:satip}X_SATIPCAP')
if satipcap is None:
raise ValueError("Invalid SAT>IP device description")
caps = {}
for system in satipcap.text.split(","):
cap = system.split("-")
if cap:
count = int(cap[1])
if cap[0] in caps:
count = count + caps[cap[0]]
caps[cap[0]] = count
result['frontends'] = caps
return result
2017-03-03 10:39:59 +01:00
2017-09-04 12:29:53 +02:00
def main():
description_urls = []
device_list = []
module = AnsibleModule(argument_spec= {}, supports_check_mode=True,)
with socket_manager(socket.AF_INET, socket.SOCK_DGRAM) as sock:
# according to Sat>IP Specification 1.2.2, p. 20
# a client should send three requests within 100 ms with a ttl of 2
for _ in range(3):
sock.sendto(ssdpRequest, (SSDP_ADDR, SSDP_PORT))
time.sleep(0.03)
try:
response = sock.recv(1024)
if response and "SERVER:" in response:
for line in response.splitlines():
if "LOCATION" in line:
url = line.split()[-1].strip()
if url not in description_urls:
description_urls.append(url)
info = requests.get(url, timeout=2)
device_list.append(parse_satip_xml(info.text))
else:
raise ValueError('No satip server detected')
except (socket.timeout, ValueError, ET.ParseError):
pass
module.exit_json(changed=False, ansible_facts= {'satip_devices': device_list})
if __name__ == '__main__':
2017-03-03 10:39:59 +01:00
main()
#+END_SRC
2017-04-10 13:24:40 +02:00
** xrandr_facts.py
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: fde80701-9abf-46ee-aa4c-d349a3a41463
:END:
2017-04-10 13:24:40 +02:00
- [ ] support multiple screens (-d :0.0 .. :0.n)
2017-04-12 10:35:12 +02:00
2018-10-01 11:12:24 +02:00
#+INCLUDE : "library/xrandr_facts.py" src python
2017-02-23 13:15:04 +01:00
* Handlers
2018-09-20 09:00:22 +02:00
:PROPERTIES:
:ID: e90af299-d84f-4924-803f-5644509c0a2f
:END:
2017-02-23 13:15:04 +01:00
#+BEGIN_SRC yaml :tangle handlers/main.yml :mkdirp yes
2017-11-13 09:46:51 +01:00
- name: Reconfigure unattended upgrades with dpkg
command: '/usr/sbin/dpkg-reconfigure --frontend noninteractive unattended-upgrades'
2017-11-18 10:15:54 +01:00
- name: Trigger Udev
command: 'udevadm trigger '
2017-11-13 09:46:51 +01:00
2017-02-23 13:15:04 +01:00
- name: Restart Samba
systemd:
name: smbd.service
state: restarted
enabled: yes
#masked: no
register: samba_reload
2017-03-13 10:40:35 +01:00
- name: Restart NFS Kernel Server
systemd:
name: nfs-server.service
state: restarted
enabled: yes
#masked: no
register: nfs_reload
2017-03-13 15:27:21 +01:00
2018-03-25 13:09:54 +02:00
- name: Restart sundtek.service
systemd:
name: sundtek.service
state: restarted
enabled: yes
masked: no
2017-03-13 15:27:21 +01:00
- name: Restart VDR
systemd:
name: vdr.service
state: restarted
enabled: yes
register: vdr_restart
2017-04-10 13:24:40 +02:00
- name: Stop VDR
systemd:
name: vdr.service
state: stopped
enabled: yes
register: vdr_stop
- name: Start VDR
systemd:
name: vdr.service
state: started
enabled: yes
register: vdr_start
2018-04-24 09:56:29 +02:00
- name: Start yavdr-xorg
systemd:
daemon_reload: yes
name: 'yavdr-xorg'
enabled: yes
state: started
register: yavdr_xorg_start
2017-04-10 13:24:40 +02:00
- name: Stop xlogin
systemd:
name: xlogin@vdr.service
state: stopped
enabled: yes
register: xlogin_stop
2018-01-07 17:58:33 +01:00
- name: Start xlogin
2018-01-07 17:55:18 +01:00
systemd:
daemon_reload: yes
name: 'xlogin@{{ vdr.user }}'
enabled: yes
state: started
register: xlogin_start
2017-04-10 13:24:40 +02:00
- name: Stop x
systemd:
name: x@vt7.service
state: stopped
register: x_stop
2018-08-10 08:13:55 +02:00
- name: reboot required
debug:
msg: PLEASE REBOOT YOUR SYSTEM.
2017-02-23 13:15:04 +01:00
#+END_SRC