Compare commits

..

No commits in common. "bionic" and "xorg-detection" have entirely different histories.

122 changed files with 3567 additions and 11811 deletions

File diff suppressed because it is too large Load Diff

4327
Manual.org

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +1,13 @@
# yavdr-ansible # yavdr-ansible
ansible playbooks for yaVDR ansible playbooks for yaVDR
## What can yavdr-ansible do for me?
[Ansible](https://docs.ansible.com/ansible/latest/index.html) is an automation tool which can be used to configure systems and deploy software.
yavdr-ansible uses Ansible to set up a yaVDR System on top of an Ubuntu 18.04 Server installation (see below for details) and allows the user to fully customize the installation - have a look at the Ansible documentation if you want to learn how it works.
Please note that this is still work in progress and several features of yaVDR 0.6 haven't been implemented (yet).
## System Requirements and Compatiblity Notes
- RTC must be set to UTC in order for vdr-addon-acpiwakeup to work properly
- 32 Bit Installations are untested, but should work
- You need an IGP/GPU with support for VDPAU or VAAPI if you want to use software output plugins for VDR like softhddevice or vaapidevice
- xineliboutput/vdr-sxfe works with software rendering, too
- Can be used in a VirtualBox VM (VirtualBox 5.22 works better than Version 6.0.0)
## Usage: ## Usage:
Set up a Ubuntu Server 18.04.x Installation and install `openssh-server`. On a Ubuntu Server 18.04.x (or minimal) Installation run the following commands:
NOTE: it is important to use the [alternative server installer](https://www.ubuntu.com/download/alternative-downloads#alternate-ubuntu-server-installer) or the [mini.iso](https://help.ubuntu.com/community/Installation/MinimalCD), otherwise the boot splash and Xorg won't work properly.
### Download yavdr-ansible
NOTE: It is recommended to use a SSH connection to run the playbook, especially if a nvidia card is used (in order to change from the nouveau to the nvidia driver the local console output needs to be disabled temporarily).
Run the following commands to download the current version of yavdr-ansible:
``` ```
sudo apt-get install git sudo apt-get install git
git clone https://github.com/yavdr/yavdr-ansible git clone https://github.com/yavdr/yavdr-ansible
cd yavdr-ansible cd yavdr-ansible
git checkout bionic git checkout bionic
sudo ./install-yavdr.sh
``` ```
### Customizing the Playbooks and Variables
You can choose the roles run by the playbooks `yavdr07.yml` or ` yavdr07-headless.yml`.
If you want to customize the variables in [group_vars/all](group_vars/all), copy the file to `host_vars/localhost` before changing it. This way you can change the PPAs used and choose which extra vdr plugins and packages should be installed by default.
### Run the Playbook
If you want a system with Xorg output run:
```
sudo -H ./install-yavdr.sh
```
NOTE: on systems with a nvidia card unloading the noveau driver after installing the proprietary nvidia driver can fail (in this case ansible throws an error). If this happens please reboot your system to allow the nvidia driver to be loaded and run the install script again.
If you want a headless vdr server run:
```
sudo -H ./install-yavdr-headless.sh
```
## First Steps after the installation:
### Wait for local dvb adapters
The yaVDR VDR Package provides a systemd service `wait-for-dvb@.service` which allows to delay the start of vdr until all given locally connected dvb adapters have been initalized - e.g. to wait for `/dev/dvb/adapter0 .. /dev/dvb/adapter3`you can enable the required instances of this service like this:
```shell
systemctl enable wait-for-dvb@{0..3}.service
```
Please remember to adapt the enabled service instances if you change your configuration.
This should work foll all DVB adaptors for which udev events are generated. Note that devices with userspace drivers (e.g. by Sundtek) won't emit such events.
### Add a /var/lib/vdr/channels.conf
You can use the wirbelscan-Plugin, w_scan, t2scan (especially useful for DVB-T2) or ready-to-use channellists from http://channelpedia.yavdr.com/gen/
Important: vdr.service must be stopped if you want to edit VDR configuration files: `sudo stop vdr.service`
### Rescan displays
If you change the connected displays you may need to update the display configuration. This can be achived by running the `yavdr-xorg` role:
```shell
sudo -H ansible-playbook yavdr07.yml -b -i 'localhost_inventory' --connection=local --tags="yavdr-xorg"
```
### running single roles without a custom playbook
You can choose to (re-)run single roles included in a playbook by including their name in the `--tags` argument (see example above for rescanning displays with `yavdr-xorg`).

View File

@ -1,5 +1,3 @@
[defaults] [defaults]
callback_plugins = plugins/callbacks callback_plugins = plugins/callbacks
callback_whitelist = auto_tags callback_whitelist = auto_tags
ansible_managed = *** ANSIBLE MANAGED FILE ***
template: {file}

View File

@ -1,8 +1,8 @@
--- ---
# file: displays.yml # file: displays.yml
# this playbook runs the yavdr-xorg role # this playbook runs the yavdr-xorg playbook
- name: rescan displays - name: set up yaVDR
hosts: all hosts: all
become: true become: true
roles: roles:

View File

@ -15,15 +15,14 @@ ANSIBLE_METADATA = {
import gettext import gettext
from ansible.errors import AnsibleFilterError from ansible.errors import AnsibleFilterError
from ansible.utils import helpers from ansible.utils import helpers
from ansible.module_utils._text import to_text
def translate_yavdr(text): def translate_yavdr(text):
gettext.textdomain('yavdr') gettext.textdomain('yavdr')
try: try:
return to_text(gettext.gettext(text)) return gettext.gettext(text)
except: except:
return to_text(text) return text
# ---- Ansible filters ---- # ---- Ansible filters ----
class FilterModule(object): class FilterModule(object):

View File

@ -1,63 +1,35 @@
--- ---
# file: group_vars/all # file: group_vars/all
# this is the standard text to put in templates
ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***\norigin: {file}"
branch: experimental branch: experimental
ppa_owner: 'ppa:yavdr' ppa_owner: 'ppa:yavdr'
# add the following PPAs # add the following PPAs
repositories: repositories:
- '{{ ppa_owner }}/{{branch}}-main' - '{{ ppa_owner }}/{{branch}}-main'
- '{{ ppa_owner }}/{{branch}}-vdr' - '{{ ppa_owner }}/{{branch}}-vdr'
- '{{ ppa_owner }}/{{branch}}-kodi'
- 'ppa:frodo-vdr/experimental-vdr-yavdr'
#- '{{ ppa_owner }}/{{branch}}-yavdr' #- '{{ ppa_owner }}/{{branch}}-yavdr'
#- '{{ ppa_owner }}/{{branch}}-kodi'
# properties of the user vdr and vdr-related options # properties of the user vdr and vdr-related options
# NOTE: user name, uid and confdir must match the values set by the vdr package
vdr: vdr:
user: vdr user: vdr
group: vdr group: vdr
uid: 666 uid: 666
gid: 666 gid: 666
home: /var/lib/vdr home: /var/lib/vdr
etc_confdir: /etc/vdr
confdir: /var/lib/vdr confdir: /var/lib/vdr
recdir: /srv/vdr/video recdir: /srv/vdr/video
hide_first_recording_level: false hide_first_recording_level: false
safe_dirnames: true # escape characters (useful for windows clients and FAT/NTFS file systems) safe_dirnames: true # escape characters (useful for windows clients and FAT/NTFS file systems)
override_vdr_charset: false override_vdr_charset: false
# copy channels.conf from a local file
# vdr_channels_conf: /path/to/channels.conf
# download channels.conf from a given url (supports HTTP(S) and FTP)
# vdr_channels_conf_url: http://example.com/vdr/channels.conf
# add the vdr plugins you want to install # add the vdr plugins you want to install
vdr_plugins: vdr_plugins:
- vdr-plugin-devstatus - vdr-plugin-devstatus
- vdr-plugin-markad - vdr-plugin-markad
- vdr-plugin-restfulapi
- vdr-plugin-softhddevice-vpp - vdr-plugin-softhddevice-vpp
- vdr-plugin-dvbapi
- vdr-plugin-satip
# IP (range) filter for vdr and plugins (this must be an array):
vdr_allowed_hosts:
- 192.168.0.0/16
#
# hosts and subnets for svdrphosts.conf (overrides vdr_allowed_hosts):
vdr_svdrphosts:
- 192.168.0.0/16
#
# hosts and subnets for allowed_hosts.conf of xineliboutput (overrides vdr_allowed_hosts):
xineliboutput_allowed_hosts:
- 192.168.0.0/16
#
# hosts and subnets for allowed_hosts.conf of vnsiserver (overrides vdr_allowed_hosts):
vnsiserver_allowed_hosts:
- 192.168.0.0/16
#
# hosts and subnets for streamdevhosts.conf (overrides vdr_allowed_hosts):
streamdev_server_allowed_hosts:
- 192.168.0.0/16
# dictionary of directories for (shared) files. Automatically exported via NFS and Samba if those roles are enabled # dictionary of directories for (shared) files. Automatically exported via NFS and Samba if those roles are enabled
media_dirs: media_dirs:
audio: /srv/audio audio: /srv/audio
@ -79,24 +51,11 @@ extra_packages:
- tree - tree
- vim - vim
- w-scan - w-scan
- t2scan
- plymouth-theme-yavdr-logo - plymouth-theme-yavdr-logo
- vdr-addon-lifeguard-ng
- vdrpbd
- wajig
frontend: vdr frontend: vdr
# vdr shutdown command - SHUTDOWNCMD variable in /etc/default/vdr
# for standby use "/bin/systemctl suspend"
vdr_shutdown_command: poweroff
#system: #system:
# shutdown: poweroff # shutdown: poweroff
wakeup_method: acpiwakeup wakeup_method: acpiwakeup
grub: grub:
timeout: 0 timeout: 0
boot_options: quiet splash boot_options: quiet splash
# Serial device to configure for a homebrew receiver.
# Choose either ttyS0 (COM1) or ttyS1 (COM2)
# Also ensure that the role serial-ir is enabled in yavdr07.yml
serial_ir_device: ttyS0

View File

@ -20,13 +20,6 @@
#masked: no #masked: no
register: nfs_reload register: nfs_reload
- name: Restart sundtek.service
systemd:
name: sundtek.service
state: restarted
enabled: yes
masked: no
- name: Restart VDR - name: Restart VDR
systemd: systemd:
name: vdr.service name: vdr.service
@ -48,15 +41,6 @@
enabled: yes enabled: yes
register: vdr_start register: vdr_start
- name: Start yavdr-xorg
systemd:
daemon_reload: yes
name: 'yavdr-xorg'
enabled: yes
state: started
register: yavdr_xorg_start
- name: Stop xlogin - name: Stop xlogin
systemd: systemd:
name: xlogin@vdr.service name: xlogin@vdr.service
@ -64,20 +48,8 @@
enabled: yes enabled: yes
register: xlogin_stop register: xlogin_stop
- name: Start xlogin
systemd:
daemon_reload: yes
name: 'xlogin@{{ vdr.user }}'
enabled: yes
state: started
register: xlogin_start
- name: Stop x - name: Stop x
systemd: systemd:
name: x@vt7.service name: x@vt7.service
state: stopped state: stopped
register: x_stop register: x_stop
- name: reboot required
debug:
msg: PLEASE REBOOT YOUR SYSTEM.

View File

@ -1,17 +0,0 @@
#!/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"

View File

@ -1,17 +1,16 @@
#!/bin/bash #!/bin/bash
set -e
if (( $EUID != 0 )); then if (( $EUID != 0 )); then
echo "This script must be run using sudo -H or as root" echo "This script must be run using sudo -H or as root"
exit exit
fi fi
apt-get -y install software-properties-common
# Add repository for ansible
add-apt-repository -y ppa:yavdr/experimental-main
# update packages # update packages
apt update apt-get update
apt -y install software-properties-common
add-apt-repository -y ppa:ansible/ansible-2.7
# install required packages # install required packages
apt-get -y install --no-install-recommends ansible python-jmespath apt-get -y install --no-install-recommends ansible
# TODO: run ansible on local host # TODO: run ansible on local host
ansible-playbook yavdr07.yml -b -i 'localhost_inventory' --connection=local --tags="all" ansible-playbook yavdr07.yml -b -i 'localhost_inventory' --connection=local --tags="all"

View File

@ -1,174 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module for reconfiguring debian packages.
(c) 2013, Sebastien Bocahu <sebastien.bocahu@nuxit.com>
This file is part of Ansible
Ansible is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Ansible is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Ansible. If not, see <http://www.gnu.org/licenses/>.
"""
DOCUMENTATION = '''
---
module: dpkg_reconfigure
short_description: Reconfigure a Debian package.
description:
- Reconfigure a Debian package using dpkg-reconfigure.
version_added: "1.2"
notes:
- A number of questions has to be answered (depending on the package).
Use 'DEBIAN_FRONTED=editor dpkg-reconfigure $pkg' for finding them.
options:
pkg:
description:
- Package to configure.
required: true
default: null
aliases: []
answers:
description:
- Debconf configuration answer(s)/question(s).
required: true
default: null
aliases: []
author: Sebastien Bocahu
'''
EXAMPLES = '''
# Set default locale to fr_FR.UTF-8, and generate en_US.UTF-8 as well:
dpkg_reconfigure:
pkg: locales
answers:
locales/default_environment_locale: fr_FR.UTF-8
locales/locales_to_be_generated: en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8
# Reconfigure roundcube, using configuration answers stored in a file:
dpkg_reconfigure: pkg=roundcube answers='$FILE(/path/dpkg-reconfigure/roundcube)'"
'''
import sys
import os
import pwd
import os.path
import re
import tempfile
def get_selections(module, pkg):
cmd = [module.get_bin_path('debconf-show', True)]
cmd.append(' %s' % pkg)
rc, out, err = module.run_command(' '.join(cmd))
if rc == 0:
selections = {}
for answer in out.split('\n'):
item = re.search('^[* ] ([^:]+): (.*)$', answer)
if item:
value = item.group(2).strip()
if value == 'true':
value = 'yes'
elif value == 'false':
value = 'no'
selections[ item.group(1).strip() ] = value
return selections
else:
module.fail_json(msg=err)
def dpkg_reconfigure(module, pkg, wanted_config):
editor_script = [ '#!/bin/sh', 'sed -i "$1" -f - <<EOF' ]
for question in wanted_config:
e_question = re.sub(r'([\\/&])', r'\\\1', question)
e_answer = re.sub(r'([\\/&])', r'\\\1', wanted_config[question])
editor_script.append('s/^\\(%s\\)\\s*=.*/\\1="%s"/' % (e_question, e_answer))
editor_script.append('EOF')
outfd, outsock_path = tempfile.mkstemp()
tmp = os.fdopen(outfd,'w')
tmp.write('\n'.join(editor_script))
tmp.close()
os.chmod(outsock_path, stat.S_IEXEC)
cmd = [ 'EDITOR=%s DEBIAN_FRONTEND=editor' % outsock_path ]
cmd.append(module.get_bin_path('dpkg-reconfigure', True))
cmd.append(pkg)
rc, out, err = module.run_command(' '.join(cmd), use_unsafe_shell=True)
os.unlink(outsock_path)
if rc == 0:
return True, err
else:
return False, err
def enforce_state(module, params):
pkg = params["pkg"]
answers = params["answers"]
wanted_config = {}
if type(answers) is dict:
wanted_config = answers
else:
for answer in answers.split('\n'):
item = re.findall(r"[^\s]+", answer)
if len(item) > 1:
wanted_config[ item[0].strip() ] = ' '.join(item[1:])
elif len(item) == 1:
wanted_config[ item[0].strip() ] = ''
for key in wanted_config:
value = wanted_config[key]
if isinstance(value, bool):
if value:
wanted_config[key] = 'yes'
else:
wanted_config[key] = 'no'
current_config = get_selections(module, params["pkg"])
already_configured = 1
for answer in wanted_config:
if not answer in current_config or current_config[answer] != wanted_config[answer]:
already_configured = 0
if already_configured:
module.exit_json(changed=False, msg="Already configured")
else:
rc, msg = dpkg_reconfigure(module, pkg, wanted_config)
if not rc:
module.fail_json(msg=msg)
params['changed'] = True
params['msg'] = msg
return params
def main():
module = AnsibleModule(
argument_spec = dict(
pkg = dict(required=True),
answers = dict(required=True),
)
)
results = enforce_state(module, module.params)
module.exit_json(**results)
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main()

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env/python
# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules.
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
@ -66,7 +66,6 @@ import os
import sys import sys
import usb.core import usb.core
from collections import namedtuple from collections import namedtuple
from itertools import chain
import kmodpy import kmodpy
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
@ -82,7 +81,7 @@ vendor_dict = {
} }
def get_pci_devices(): def get_pci_devices():
for device in chain(glob.glob('/sys/devices/pci*/*:*:*/'), glob.glob('/sys/devices/pci*/*:*:*/*:*:*/')): for device in glob.glob('/sys/devices/pci*/*:*:*/*:*:*/'):
try: try:
with open(os.path.join(device, 'device')) as d: with open(os.path.join(device, 'device')) as d:
product_id = int(d.read().strip(), 16) product_id = int(d.read().strip(), 16)

View File

@ -1,69 +0,0 @@
#!/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()

View File

@ -1,83 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Alexander Grothe <seahawk1986@gmx.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: rmmod
short_description: unload kernel modules with rmmod
version_added: 2.7
author:
- Alexander Grothe
description:
- Unload kernel modules with rmmod.
- Builtin kernel modules can't be removed (will do nothing in this case).
options:
name:
required: true
description:
- Name of kernel module to remove.
'''
EXAMPLES = '''
- name: Unload nouveau module
rmmod:
name: nouveau
'''
def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(type='str', required=True),
),
supports_check_mode=True,
)
name = module.params['name']
# FIXME: Adding all parameters as result values is useless
result = dict(
changed=False,
name=name,
)
# Check if module is loaded
try:
is_loaded = False
with open('/proc/modules') as modules:
module_name = name.replace('-', '_') + ' '
for line in modules:
if line.startswith(module_name):
is_loaded = True
break
except IOError as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc(), **result)
# remove module if it is loaded
if is_loaded:
if not module.check_mode:
rc, out, err = module.run_command([module.get_bin_path('rmmod', True), name])
if rc != 0:
module.fail_json(msg=err, rc=rc, stdout=out, stderr=err, **result)
result['changed'] = True
module.exit_json(**result)
if __name__ == '__main__':
main()

View File

@ -3,31 +3,20 @@ from __future__ import print_function
import ast import ast
import binascii import binascii
import csv import csv
import os
import re import re
import subprocess import subprocess
from collections import namedtuple from collections import namedtuple
from glob import glob
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import *
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: xrandr_facts module: xrandr_facts
short_description: "gather facts about connected monitors and available modelines" short_description: "gather facts about connected monitors and available modelines"
description: description:
- This module needs a running x-server on a given display in - This module needs a running x-server on a given display in order to successfully call xrandr.
order to successfully call xrandr. Returns the dictionary Returns the dictionary "xrandr", wich contains all screens with output states, connected displays,
"xrandr", wich contains all screens with output states, EDID info and their modes and a recommendation for the best fitting tv mode.
connected displays, EDID info and their modes and a
recommendation for the best fitting tv mode, the dictionary
"xorg" with a recommendation for the primary and secondary
output and a "drm" dictionary whose "primary" key associates
the primary device name of the drm subsystem with the one from
the xrandr output by comparing the edid data and a list of
"ignored_devices". Note that the proprietary nvidia driver
doesn't support KMS/drm, so in this case the dictionary is
always empty.
options: options:
display: display:
required: False required: False
@ -36,7 +25,7 @@ options:
- the DISPLAY variable to use when calling xrandr - the DISPLAY variable to use when calling xrandr
preferred_outputs: preferred_outputs:
required: False required: False
default: ["HDMI", "DP", "eDP", "DVI", "VGA", "TV", "Virtual"] default: ["HDMI", "DP", "DVI", "VGA", "TV"]
description: description:
- ranking of the preferred display connectors - ranking of the preferred display connectors
preferred_refreshrates: preferred_refreshrates:
@ -54,7 +43,6 @@ options:
default: True default: True
description: description:
- write edid data to /etc/X11/edid.{connector}.bin - write edid data to /etc/X11/edid.{connector}.bin
- the dictionary "drm" can only be filled with data if write_edids is enabled
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: "collect facts for connected displays" - name: "collect facts for connected displays"
@ -66,15 +54,12 @@ EXAMPLES = '''
- debug: - debug:
var: xorg var: xorg
- debug:
var: drm
''' '''
ARG_SPECS = { ARG_SPECS = {
'display': dict(default=":0", type='str', required=False), 'display': dict(default=":0", type='str', required=False),
'preferred_outputs': dict( 'preferred_outputs': dict(
default=["HDMI", "DP", "eDP", "DVI", "VGA", "TV", "Virtual"], type='list', required=False), default=["HDMI", "DP", "DVI", "VGA", "TV"], type='list', required=False),
'preferred_refreshrates': dict( 'preferred_refreshrates': dict(
default=[50, 60, 75, 30, 25], type='list', required=False), default=[50, 60, 75, 30, 25], type='list', required=False),
'preferred_resolutions': dict( 'preferred_resolutions': dict(
@ -82,23 +67,21 @@ ARG_SPECS = {
"7680x4320", "3840x2160", "1920x1080", "1280x720", "720x576"], "7680x4320", "3840x2160", "1920x1080", "1280x720", "720x576"],
type='list', required=False), type='list', required=False),
'write_edids': dict(default=True, type='bool', required=False), 'write_edids': dict(default=True, type='bool', required=False),
} }
SCREEN_REGEX = re.compile(r"^(?P<screen>Screen\s\d+:)(?:.*)") SCREEN_REGEX = re.compile("^(?P<screen>Screen\s\d+:)(?:.*)")
CONNECTOR_REGEX = re.compile( CONNECTOR_REGEX = re.compile(
r"^(?P<connector>.*-?\d+)\s(?P<connection_state>connected|disconnected)\s(?P<primary>primary)?") "^(?P<connector>.*-\d+)\s(?P<connection_state>connected|disconnected)\s(?P<primary>primary)?")
MODE_REGEX = re.compile(r"^\s+(?P<resolution>\d{3,}x\d{3,}).*") MODE_REGEX = re.compile("^\s+(?P<resolution>\d{3,}x\d{3,}).*")
Mode = namedtuple('Mode', ['connection', 'resolution', 'refreshrate']) Mode = namedtuple('Mode', ['connection', 'resolution', 'refreshrate'])
def check_for_screen(line): def check_for_screen(line):
"""check line for screen information""" """check line for screen information"""
match = re.match(SCREEN_REGEX, line) match = re.match(SCREEN_REGEX, line)
if match: if match:
return match.groupdict()['screen'] return match.groupdict()['screen']
def check_for_connection(line): def check_for_connection(line):
"""check line for connection name and state""" """check line for connection name and state"""
match = re.match(CONNECTOR_REGEX, line) match = re.match(CONNECTOR_REGEX, line)
@ -110,12 +93,10 @@ def check_for_connection(line):
is_connected = True if match['connection_state'] == 'connected' else False is_connected = True if match['connection_state'] == 'connected' else False
return connector, is_connected return connector, is_connected
def get_indentation(line): def get_indentation(line):
"""return the number of leading whitespace characters""" """return the number of leading whitespace characters"""
return len(line) - len(line.lstrip()) return len(line) - len(line.lstrip())
def sort_mode(mode): def sort_mode(mode):
"""rate modes by several criteria""" """rate modes by several criteria"""
connection_score = 0 connection_score = 0
@ -131,13 +112,12 @@ def sort_mode(mode):
rrate_score = len(preferred_rrates) - preferred_rrates.index(mode.refreshrate) rrate_score = len(preferred_rrates) - preferred_rrates.index(mode.refreshrate)
if mode.resolution in preferred_resolutions: if mode.resolution in preferred_resolutions:
resolution_score = len(preferred_resolutions) - preferred_resolutions.index(mode.resolution) resolution_score = len(preferred_resolutions) - preferred_resolutions.index(mode.resolution)
x_resolution, y_resolution = (int(n) for n in mode.resolution.split('x')) x_resolution, y_resolution = (int(n) for n in mode.resolution.split('x'))
connection = mode.connection.split('-')[0] connection = mode.connection.split('-')[0]
if connection in preferred_outputs: if connection in preferred_outputs:
connection_score = len(preferred_outputs) - preferred_outputs.index(connection) connection_score = len(preferred_outputs) - preferred_outputs.index(connection)
return (rrate_score, resolution_score, x_resolution, y_resolution, connection_score) return (rrate_score, resolution_score, x_resolution, y_resolution, connection_score)
def parse_xrandr_verbose(iterator): def parse_xrandr_verbose(iterator):
"""parse the output of xrandr --verbose using an iterator delivering single lines""" """parse the output of xrandr --verbose using an iterator delivering single lines"""
xorg = {} xorg = {}
@ -155,7 +135,7 @@ def parse_xrandr_verbose(iterator):
'preferred': '', 'preferred': '',
'current': '', 'current': '',
'auto': '', 'auto': '',
} }
elif is_connected and 'EDID:' in line: elif is_connected and 'EDID:' in line:
edid_str = "" edid_str = ""
outer_indentation = get_indentation(line) outer_indentation = get_indentation(line)
@ -166,7 +146,7 @@ def parse_xrandr_verbose(iterator):
else: else:
break break
xorg[screen][connector]['EDID'] = edid_str xorg[screen][connector]['EDID'] = edid_str
elif is_connected and "MHz" in line and "Interlace" not in line: elif is_connected and "MHz" in line and not "Interlace" in line:
match = re.match(MODE_REGEX, line) match = re.match(MODE_REGEX, line)
if match: if match:
match = match.groupdict() match = match.groupdict()
@ -191,59 +171,30 @@ def parse_xrandr_verbose(iterator):
break break
return xorg return xorg
def parse_edid_data(edid): def parse_edid_data(edid):
vendor = "Unknown" vendor = "Unknown"
model = "Unknown" model = "Unknown"
modelines = [] data = subprocess.check_output("parse-edid < {}".format(edid), shell=True, universal_newlines=True)
try: for line in data.splitlines():
data = subprocess.check_output("parse-edid < {}".format(edid), if "VendorName" in line:
shell=True, universal_newlines=True) vendor = line.strip().split('"')[1]
except subprocess.CalledProcessError: if "ModelName" in line:
pass model = line.strip().split('"')[1]
else: return vendor, model
for line in data.splitlines():
line = line.strip()
if "VendorName" in line:
vendor = line.split('"')[1]
if "ModelName" in line:
model = line.split('"')[1]
if "Modeline" in line:
print(line)
_, _, line = line.split('"', 2)
if not line:
print("no timing information")
continue
try:
FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS = line.split(None, 9)
except ValueError:
print("invalid timing information")
continue
print(FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS)
refresh = round(float(FF) * 1E6 / (float(H4) * float(V4)))
interlaced = "interlaced" in FLAGS
if interlaced:
refresh /= 2
refresh = int(refresh)
modeline_name = '"{}x{}_{}{}"'.format(H1, V1, refresh, "i" if interlaced else '')
modelines.append(" ".join(("Modeline", modeline_name,
FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS)))
return vendor, model, modelines
def collect_nvidia_data(): def collect_nvidia_data():
BusID_RE = re.compile(( BusID_RE = re.compile((
r'(?P<domain>[0-9a-fA-F]+)' '(?P<domain>[0-9a-fA-F]+)'
r':' ':'
r'(?P<bus>[0-9a-fA-F]+)' '(?P<bus>[0-9a-fA-F]+)'
r':' ':'
r'(?P<device>[0-9a-fA-F]+)' '(?P<device>[0-9a-fA-F]+)'
r'\.' '\.'
r'(?P<function>[0-9a-fA-F]+)' '(?P<function>[0-9a-fA-F]+)'
)) ))
try: try:
data = subprocess.check_output(["nvidia-smi", "--query-gpu=name,pci.bus_id", data = subprocess.check_output(["nvidia-smi", "--query-gpu=name,pci.bus_id", "--format=csv", "-i0"],
"--format=csv", "-i0"], universal_newlines=True) universal_newlines=True)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
pass pass
except OSError: except OSError:
@ -262,77 +213,7 @@ def collect_nvidia_data():
raise ValueError raise ValueError
def find_drm_connectors(connections):
"""
returns a dict with the following schema (secondary may be empty):
{
'primary': {
'edid': 'edid.HDMI-1.bin',
'drm_connector': 'HDMI-A-1',
'xrandr_connector': 'HDMI-1',
},
'secondary': {
'edid': 'edid.eDP-1.bin',
'drm_connector': 'eDP-1',
'xrandr_connector': 'eDP-1',
}
'ignored_outputs': ['HDMI-A-2', 'DP-1']
}
"""
STATUS_GLOB = '/sys/class/drm/card0*/status'
CONNECTOR_RE = re.compile('card0-(?P<connector>[^/]+)/status')
def read_edid_bytes(edid_file):
edid_bytes = b''
try:
with open(edid_file, 'rb') as f:
edid_bytes = f.read()
except IOError:
pass
return edid_bytes
xrandr_edid_bytes = read_edid_bytes(connections.get('primary', {}).get('edid', ""))
secondary_xrandr_edid_bytes = read_edid_bytes(connections.get('secondary', {}).get('edid', ''))
drm = {'primary': {}, 'secondary': {}, 'ignored_outputs': []}
for status_p in glob(STATUS_GLOB):
match = re.search(CONNECTOR_RE, status_p)
if match:
drm_connector = match.group('connector')
else:
continue
try:
with open(status_p) as f:
connected = f.read().strip() == 'connected'
except IOError:
continue
if connected:
edid = read_edid_bytes(os.path.join(
os.path.dirname(status_p), 'edid'))
if edid:
if edid == xrandr_edid_bytes:
drm['primary'] = {
'edid': os.path.basename(connections['primary'].get('edid', "")),
'drm_connector': drm_connector,
'xrandr_connector': connections['primary'].get('connector',''),
}
continue
if secondary_xrandr_edid_bytes:
drm['secondary'] = {
'edid': os.path.basename(connections.get('secondary').get('edid', '')),
'drm_connector': drm_connector,
'xrandr_connector': connections['secondary'].get('connector',''),
}
continue
drm['ignored_outputs'].append(drm_connector)
return drm
def output_data(data, write_edids=True): def output_data(data, write_edids=True):
result = {}
drm = {}
if data: if data:
modes = [] modes = []
for _, screen_data in data.items(): for _, screen_data in data.items():
@ -344,13 +225,14 @@ def output_data(data, write_edids=True):
for refreshrate in refreshrates: for refreshrate in refreshrates:
modes.append(Mode(connector, resolution, refreshrate)) modes.append(Mode(connector, resolution, refreshrate))
if modes: if modes:
result = {}
try: try:
gpu_name, bus_id = collect_nvidia_data() gpu_name, bus_id = collect_nvidia_data()
except ValueError: except ValueError:
gpu_name = None gpu_name = None
bus_id = None bus_id = None
def create_entry(my_dict, name, connector, resolution, refreshrate, vendor, model, modelines): def create_entry(my_dict, name, connector, resolution, refreshrate, vendor, model):
my_dict[name] = { my_dict[name] = {
'connector': connector, 'connector': connector,
'resolution': resolution, 'resolution': resolution,
@ -359,40 +241,29 @@ def output_data(data, write_edids=True):
'mode': "{}_{}".format(resolution, refreshrate), 'mode': "{}_{}".format(resolution, refreshrate),
'vendor': vendor, 'vendor': vendor,
'model': model, 'model': model,
'modelines': modelines,
} }
if gpu_name and bus_id: if gpu_name and bus_id:
result[name]['gpu_name'] = gpu_name result[name]['gpu_name'] = gpu_name
result[name]['bus_id'] = bus_id result[name]['bus_id'] = bus_id
connector_0, resolution_0, refreshrate_0 = max(modes, key=sort_mode)[:3] connector_0, resolution_0, refreshrate_0 = max(modes, key=sort_mode)[:3]
connector_0_edid = '/etc/X11/edid.{}.bin'.format(connector_0) vendor_0, model_0 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_0))
vendor_0, model_0, modelines_0 = parse_edid_data(connector_0_edid) create_entry(result, 'primary', connector_0, resolution_0, refreshrate_0, vendor_0, model_0)
create_entry(result, 'primary', connector_0, resolution_0,
refreshrate_0, vendor_0, model_0, modelines_0)
# check if additional monitors exist # check if additional monitors exist
other_modes = [mode for mode in modes if mode[0] != connector_0] other_modes = [mode for mode in modes if mode[0] != connector_0]
if other_modes: if other_modes:
connector_1, resolution_1, refreshrate_1 = max(other_modes, key=sort_mode)[:3] connector_1, resolution_1, refreshrate_1 = max(other_modes, key=sort_mode)[:3]
connector_1_edid = '/etc/X11/edid.{}.bin'.format(connector_1) vendor_1, model_1 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_1))
vendor_1, model_1, modelines_1 = parse_edid_data(connector_1_edid) create_entry(result, 'secondary', connector_1, resolution_1, refreshrate_1, vendor_1, model_1)
create_entry(result, 'secondary', connector_1, resolution_1,
refreshrate_1, vendor_1, model_1, modelines_1)
if write_edids:
drm = find_drm_connectors(result)
module.exit_json(changed=True if write_edids else False,
ansible_facts={'xrandr': data, 'xorg': result, 'drm': drm})
#print(json.dumps(data, sort_keys=True, indent=4))
module.exit_json(changed=True if write_edids else False, ansible_facts={'xrandr': data, 'xorg': result})
if __name__ == '__main__': if __name__ == '__main__':
module = AnsibleModule(argument_spec=ARG_SPECS, supports_check_mode=False,) module = AnsibleModule(argument_spec=ARG_SPECS, supports_check_mode=False,)
try: try:
d = subprocess.check_output(['xrandr', '-d', module.params['display'], '--verbose'], d = subprocess.check_output(['xrandr', '-d', module.params['display'], '--verbose'], universal_newlines=True).splitlines()
universal_newlines=True).splitlines()
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
xorg_data = {} xorg_data = {}
else: else:

View File

@ -1,4 +1,3 @@
--- ---
dependencies: dependencies:
- { role: collect-facts }
- { role: yavdr-remote } - { role: yavdr-remote }

View File

@ -26,6 +26,7 @@
masked: no masked: no
daemon_reload: yes daemon_reload: yes
with_items: with_items:
- eventlircd.socket
- eventlircd.service - eventlircd.service
- lircd2uinput.service - lircd2uinput.service
- lircd.service - lircd.service

View File

@ -1,4 +1,4 @@
{{ ansible_managed | comment }} {{ ansible_managed_file | comment }}
[lircd] [lircd]
nodaemon = False nodaemon = False

View File

@ -1,3 +0,0 @@
---
dependencies:
- { role: collect-facts }

View File

@ -3,8 +3,6 @@
- name: apt | install vdr-plugin-dvbhddevice if connected - name: apt | install vdr-plugin-dvbhddevice if connected
apt: apt:
name: name: vdr-plugin-dvbhddevice
- vdr-plugin-dvbhddevice
- yavdr-firmware
when: '"13c2:300a" in pci or "13c2:300b" in pci' when: '"13c2:300a" in pci or "13c2:300b" in pci'
notify: [ 'Restart VDR' ] notify: [ 'Restart VDR' ]

View File

@ -1,3 +0,0 @@
---
dependencies:
- { role: collect-facts }

View File

@ -5,8 +5,6 @@
- name: apt | install vdr-plugin-dvbsddevice if module is loaded - name: apt | install vdr-plugin-dvbsddevice if module is loaded
apt: apt:
name: name: vdr-plugin-dvbsddevice
- vdr-plugin-dvbsddevice
- yavdr-firmware
when: '"dvb_ttpci" in modules' when: '"dvb_ttpci" in modules'
notify: [ 'Restart VDR' ] notify: [ 'Restart VDR' ]

View File

@ -1,3 +0,0 @@
---
dependencies:
- { role: collect-facts }

View File

@ -35,7 +35,7 @@
state: absent state: absent
when: when:
- dvbsky_firmware_files is defined - dvbsky_firmware_files is defined
- dvbsky_firmware_files | bool - dvbsky_firmware_files
tags: tags:
- install - install
- autodetect - autodetect

View File

@ -1,3 +0,0 @@
---
dependencies:
- { role: collect-facts }

View File

@ -1,33 +0,0 @@
---
# This role provides easyily downloadable firmware files
- name: Firmware dvb-demod-si2168-b40-01.fw for Hauppauge WinTV HD Solo/Duo, PCTV 292e
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'
- name: Firmware dvb-fe-xc5000-1.6.114.fw for Hauppauge WinTV-HVR-930C
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'
- 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

View File

@ -5,4 +5,4 @@
apt: apt:
name: yavdr-hardware-irmp name: yavdr-hardware-irmp
state: present state: present
when: '"1209:4444" in usb or "16c0:27d9" in usb' when: '"1209:4444" in usb'

View File

@ -12,5 +12,5 @@
apt: apt:
name: vdr-plugin-satip name: vdr-plugin-satip
state: present state: present
when: satip_devices | bool when: satip_devices
notify: [ 'Restart VDR' ] notify: [ 'Restart VDR' ]

View File

@ -10,7 +10,7 @@
- name: use ubuntu-drivers to install additional drivers automatically - name: use ubuntu-drivers to install additional drivers automatically
command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall
when: (ansible_virtualization_type != "virtualbox" and ansible_virtualization_role != "guest") when: (ansible_virtualization_type != "virtualbox" and ansible_virtualization_role != "guest") or
ansible_distribution_version != "16.04"
# ubuntu-drivers-common tries to autoinstall # ubuntu-drivers-common tries to autoinstall
# conflicting packages for virtualbox in Ubuntu 16.04 and 18.04 :( # conflicting packages for virtualbox in Ubuntu 16.04 :(
# also alternates between virtualbox-guest-dkms and virtualbox-guest-dkms-hwe on successive runs

View File

@ -1,41 +1,20 @@
--- ---
# file roles/autoinstall-virtualbox-guest/tasks/main.yml # file roles/autoinstall-virtualbox-guest/tasks/main.yml
- name: collect facts about installed packages
package_facts:
manager: "apt"
- name: install virtualbox guest additions - name: install virtualbox guest additions
block: block:
- name: install packages - name: install packages
apt: apt:
state: present state: present
name: name: '{{ item }}'
- dkms with_items:
- '{{ "virtualbox-guest-x11-hwe" if "xserver-xorg-hwe-18.04" in ansible_facts.packages else "virtualbox-guest-x11" }}' - virtualbox-guest-dkms
- '{{ "virtualbox-guest-dkms-hwe" if "linux-generic-hwe-18.04" in ansible_facts.packages else "virtualbox-guest-dkms" }}' - virtualbox-guest-x11
- dkms
# TODO: set xineliboutput as frontend # TODO: set xineliboutput as frontend
when: when:
- ansible_virtualization_type == "virtualbox" - ansible_virtualization_type == "virtualbox"
- ansible_virtualization_role == "guest" - ansible_virtualization_role == "guest"
- ansible_distribution == "Ubuntu" - ansible_distribution == "Ubuntu"
- ansible_distribution_version == "16.04"
- name: set xineliboutput as frontend
block:
- apt:
name:
- vdr-plugin-xineliboutput
- xineliboutput-sxfe
state: present
- command: '{{ item }}'
with_items:
- vdrctl disable softhddevice
- vdrctl disable vaapidevice
- vdrctl disable xine
- vdrctl disable pvr350
- vdrctl enable xineliboutput
ignore_errors: yes
when:
- ansible_virtualization_type in ["virtualbox", "VirtualPC", "VMware"]
- ansible_virtualization_role == "guest"

View File

@ -1,3 +0,0 @@
---
dependencies:
- { role: yavdr-remote }

View File

@ -1,35 +0,0 @@
---
# 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
when: '"10c4:876c" in usb'

View File

@ -1,20 +0,0 @@
{{ ansible_managed | comment }}
[lircd]
nodaemon = False
driver = ya_usbir
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 = ...
[lircmd]
uinput = False
nodaemon = False

View File

@ -1 +0,0 @@

View File

@ -22,15 +22,6 @@
- amd_detected - amd_detected
- virtualbox_detected - virtualbox_detected
- name: get detailed PCI device information
pci_facts:
tags:
- always
- debug:
var: pci_devices
verbosity: 1
- name: known vdr output plugins - name: known vdr output plugins
set_fact: set_fact:
vdr_output_plugins: vdr_output_plugins:

View File

@ -8,20 +8,24 @@
- name: apt | install libdvd-pkg - name: apt | install libdvd-pkg
apt: apt:
name: libdvd-pkg name: '{{ item }}'
state: present state: present
install_recommends: no install_recommends: no
with_items:
- 'libdvd-pkg'
- name: reconfigure libdvd-pkg - name: configure package libdvd-pkg
dpkg_reconfigure: debconf:
pkg: libdvd-pkg name: 'libdvd-pkg'
answers: | question: '{{ item }}'
libdvd-pkg/post-invoke_hook-install: boolean true vtype: boolean
libdvd-pkg/build: boolean true value: true
with_items:
- 'libdvd-pkg/post-invoke_hook-install'
- 'libdvd-pkg/build boolean'
notify: ['Reconfigure unattended upgrades with dpkg']
- name: change udev rule to allow KODI to eject optical disks - name: change udev rule to allow KODI to eject optical disks
shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules
args: args:
creates: /etc/udev/rules.d/60-cdrom_id.rules creates: /etc/udev/rules.d/60-cdrom_id.rules
warn: false

View File

@ -1,40 +0,0 @@
---
# file: roles/epgd/defaults/main.yml
epgd_dbhost: localhost
epgd_dbport: 3306
epgd_dbname: epg2vdr
epgd_dbuser: epg2vdr
epgd_dbpass: epg
epgd_epgview: eventsview.sql
epgd_epgviewweb: eventsviewplain.sql
epgd_thetvdbview: thetvdbview.sql
epgd_checkinitial: 1
epgd_daysinadvance: 8
epgd_daystoupdate: 4
epgd_updatetime: 12
epgd_updatethreshold: 500
epgd_xmlstoretofs: 0
epgd_getepgimages: 1
# EpgImageSize
# 0 = 174x130
# 1 = 329x245
# 2 = 525x400
epgd_epgimagesize: 2
epgd_maximagesperevent: 1
epgd_seriesenabled: 1
epgd_seriesport: 2006
epgd_seriesstoretofs: 0
epgd_seriesurl: www.eplists.de
epgd_scrapepg: 1
epgd_scrapRecordings: 1
#epgd_scrapmoviedbapikey: ""
epgd_cachepath: /var/cache/epgd/
epgd_epghttpd_port: 9999
#epgd_httpproxy: 127.0.0.1:8000
epgd_httpproxy_username: ""
epgd_httpproxy_password: ""
epgd_LogLevel: 1
epgd_epgdata_url: http://www.epgdata.com
epgd_epgdata_pin: insert-your-pin-here
epgd_epgdata_timeout: 180

View File

@ -1,98 +0,0 @@
---
# file: roles/epgd/tasks/main.yml
#Installing mariadb, epg-daemon and epg2vdr.
#bind-address is set to 0.0.0.0 --> 99-epgd.cnf.
#The root SQL password is only stored (NONE), because the epgd-tool
#is expecting it. But it is not really used,
#because the connection is established via a socket without a password.
#Normal users must use sudo if they want to access mysql as root.
#TODO:
# - Create channelmap if channels.conf is present.
# (the script already exists at mld.)
# - because skindesigner-logos delivers only svg-logos, logoSuffix svg should be the preset --> vdr-epg-daemon / lib / parameters.c
# - customize epgd-tool for mariadb
- name: MariaDB and Plugin | install
apt:
name: ['mariadb-server', 'mariadb-plugin-epglv', 'python-pymysql']
state: present
- name: copy file | epgd mariadb config
template:
src: templates/etc_mysql_mariadb.conf.d_99-epgd.cnf.j2
dest: /etc/mysql/mariadb.conf.d/99-epgd.cnf
owner: root
group: root
- name: create /root/.ssh if it doesn't exist yes
file:
path: /root/.ssh
state: directory
owner: root
group: root
mode: 0700
- name: copy file | mysqlpasswd
template:
src: templates/root_.ssh_mysqlpasswd.j2
dest: /root/.ssh/mysqlpasswd
owner: root
group: root
mode: 0600
backup: yes
- name: Restart mariadb
systemd:
name: mariadb.service
state: restarted
enabled: yes
masked: no
- name: Create a new database for epgd
mysql_db:
name: "{{ epgd_dbname }}"
encoding: utf8
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create User for epgd database
mysql_user:
name: "{{ epgd_dbuser }}"
password: "{{ epgd_dbpass }}"
host: '%'
priv: '{{ epgd_dbname }}.*:ALL'
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create User for epgd database
mysql_user:
name: "{{ epgd_dbuser }}"
password: "{{ epgd_dbpass }}"
host: 'localhost'
priv: '{{ epgd_dbname }}.*:ALL'
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: create epgd config folder
file:
path: /etc/epgd
state: directory
- name: epgd config
template:
src: templates/etc_epgd_epgd.conf.j2
dest: /etc/epgd/epgd.conf
- name: epgd | install
apt:
name: ['vdr-epg-daemon', 'vdr-plugin-epg2vdr', 'skindesigner-logos']
state: present
#- name: epgd | start
#systemd:
#name: epgd_service
#state: started
#enabled: yes
#masked: no

View File

@ -1,74 +0,0 @@
{{ ansible_managed | comment }}
# ------------------------------------
# Configuration of EPG Daemon
# ------------------------------------
DbHost = {{ epgd_dbhost }}
DbPort = {{ epgd_dbport }}
DbName = {{ epgd_dbname }}
DbUser = {{ epgd_dbuser }}
DbPass = {{ epgd_dbpass }}
EpgView = {{ epgd_epgview }}
EpgViewWeb = {{ epgd_epgviewweb }}
TheTvDBView = {{ epgd_thetvdbview }}
CheckInitial = {{ epgd_checkinitial }}
DaysInAdvance = {{ epgd_daysinadvance }}
DaysToUpdate = {{ epgd_daystoupdate }}
UpdateTime = {{ epgd_updatetime }}
UpdateThreshold = {{ epgd_updatethreshold }}
XmlStoreToFs = {{ epgd_xmlstoretofs }}
GetEPGImages = {{ epgd_getepgimages }}
# EpgImageSize
# 0 = 174x130
# 1 = 329x245
# 2 = 525x400
EpgImageSize = {{ epgd_epgimagesize }}
MaxImagesPerEvent = {{ epgd_maximagesperevent }}
SeriesEnabled = {{ epgd_seriesenabled }}
SeriesPort = {{ epgd_seriesport }}
SeriesStoreToFs = {{ epgd_seriesstoretofs }}
SeriesUrl = {{ epgd_seriesurl }}
ScrapEpg = {{ epgd_scrapepg }}
ScrapRecordings = {{ epgd_scrapRecordings }}
{% if epgd_scrapmoviedbapikey is defined %}
ScapMovieDbApiKey = {{ epgd_scrapmoviedbapikey }}
{% else %}
#ScrapMovieDbApiKey =
{% endif %}
{% if epgd_netdevice is defined %}
NetDevice = {{ epgd_netdevice }}
{% else %}
# NetDevice = eth0
{% endif %}
CachePath = {{ epgd_cachepath }}
HttpPort = {{ epgd_epghttpd_port }}
{% if epgd_httpproxy is defined %}
HttpProxy = {{ epgd_httpproxy }}
UserName = {{ epgd_httpproxy_username }}
Password = {{ epgd_httpproxy_password }}
{% else %}
# HttpProxy = 127.0.0.1:8000
# UserName =
# Password =
{% endif %}
LogLevel = {{ epgd_LogLevel }}
# ---------------
# epgdata plugin
# ---------------
epgdata.url = {{ epgd_epgdata_url }}
epgdata.pin = {{ epgd_epgdata_pin }}
# Download timeout in seconds (default 180)
epgdata.timeout = {{ epgd_epgdata_timeout }}

View File

@ -1,4 +0,0 @@
{{ ansible_managed | comment }}
[mysqld]
bind-address = 0.0.0.0

View File

@ -1,2 +0,0 @@
{{ ansible_managed | comment }}
PASSWORD=NONE

View File

@ -1,10 +1,5 @@
--- ---
- name: Update Initramfs
command: "update-initramfs -u"
failed_when: ('error' in initramfs_register_update.stderr)
register: initramfs_register_update
- name: Update GRUB - name: Update GRUB
command: update-grub command: update-grub
failed_when: ('error' in grub_register_update.stderr) failed_when: ('error' in grub_register_update.stderr)

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
{{ ansible_managed | comment }}
exec tail -n +3 $0 exec tail -n +3 $0
# This file is configured by the ansible configuration for yaVDR
{% if system.shutdown is defined and system.shutdown == 'reboot' %} {% if system.shutdown is defined and system.shutdown == 'reboot' %}
menuentry "PowerOff" { menuentry "PowerOff" {
halt halt

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<lircmap> <lircmap>
<remote device="linux-input-layer"> <remote device="linux-input-layer">
<altname>cx23885_remote</altname> <altname>cx23885_remote</altname>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file contains the mapping of keys (gamepad, remote, and keyboard) to actions within XBMC --> <!-- This file contains the mapping of keys (gamepad, remote, and keyboard) to actions within XBMC -->
<!-- The <global> section is a fall through - they will only be used if the button is not --> <!-- The <global> section is a fall through - they will only be used if the button is not -->
<!-- used in the current window's section. Note that there is only handling --> <!-- used in the current window's section. Note that there is only handling -->

View File

@ -35,9 +35,4 @@
group: '{{ vdr.group }}' group: '{{ vdr.group }}'
mode: "0664" mode: "0664"
force: no force: no
# TODO: Add configuration files
- name: expand template for set-kodi-display
template:
src: 'templates/set-kodi-display.j2'
dest: '/usr/bin/set-kodi-display'
mode: "0755"

View File

@ -2,24 +2,10 @@
- name: apt | install kodi packages - name: apt | install kodi packages
apt: apt:
name: name: '{{ item }}'
- kodi
- kodi-pvr-vdr-vnsi
- python3-lxml
state: present state: present
install_recommends: no install_recommends: no
with_items:
- name: apt | install kodi-send (team-xbmc PPA) - kodi
apt: - kodi-pvr-vdr-vnsi
name: "kodi-eventclients-xbmc-send" # team-xbmc uses "kodi-eventclients-xbmc-send for some reason - kodi-eventclients-kodi-send # for ubuntu packages, team-xbmc uses "kodi-eventclients-xbmc-send for some reason
state: present
install_recommends: no
register: team_xbmc_ppa
ignore_errors: True
- name: apt | install kodi-send (Ubuntu package)
apt:
name: "kodi-eventclients-kodi-send" # fallback to ubuntu package
state: present
install_recommends: no
when: team_xbmc_ppa.failed

View File

@ -1,10 +1,2 @@
- import_tasks: install-kodi.yml - import_tasks: install-kodi.yml tags=install,update,kodi:install
tags: - import_tasks: configure-kodi.yml tags=install,update,kodi:configure
- install
- update
- kodi:install
- import_tasks: configure-kodi.yml
tags:
- install
- update
- kodi:configure

View File

@ -8,5 +8,5 @@ ExecStartPre=-/usr/bin/set-kodi-display
ExecStart=/usr/bin/kodi -l /run/lirc/lircd ExecStart=/usr/bin/kodi -l /run/lirc/lircd
ExecStop=/bin/bash -c "/usr/bin/kodi-send --action=QUIT; while ps -p $MAINPID -o comm=; do sleep .25; done" ExecStop=/bin/bash -c "/usr/bin/kodi-send --action=QUIT; while ps -p $MAINPID -o comm=; do sleep .25; done"
TimeoutStopSec=10 TimeoutStopSec=10
SuccessExitStatus=0 127 SIGKILL SuccessExitStatus=0 127
Restart=on-failure Restart=on-failure

View File

@ -1,117 +0,0 @@
#!/usr/bin/env python3
"""
{{ ansible_managed }}
This Script changes the monitor in KODI's guisettings.xml to the wanted output
according to the DISPLAY environment variable. It works with KODI 18 (not KODI 17!).
In order to change the display we need to modify the settings/videoscreen nodes.
Basic algorithm:
- get the current videoscreen.monitor
- check if it needs to be changed
- create a backup of the videoscreen nodes in /var/lib/vdr/.kodi/.display_cache/{CONNETOR}-videoscreen.xml
- check if there is an existing backup for the new CONNECTOR
- parse the backup of the videoscreen nodes
- replace the videoscreen nodes with the backup data
"""
import copy
import os
import sys
import subprocess
from lxml import etree as ET
GUISETTINGS = '/var/lib/vdr/.kodi/userdata/guisettings.xml'
CACHE_DIR = '/var/lib/vdr/.kodi/.display_cache'
VIDEOSCREEN_TEMPLATE = """<settings version="2">
<setting id="videoscreen.monitor">{}</setting>
</settings>"""
def create_cache_dir():
try:
os.makedirs(CACHE_DIR, exist_ok=True)
except PermissionError:
sys.exit(f"Error: insufficient permissions to create cachedir {CACHE_DIR}")
except Exception as e:
sys.exit(f"Unexpected Error when trying to create {CACHE_DIR}:", e)
def get_output_name():
"""
get display name from xrandr output for given DISPLAY environment variable
"""
try:
xrandr_output = [
l for l in subprocess.check_output(
["xrandr"],
env={"DISPLAY": os.environ["DISPLAY"]}
).decode("utf-8").splitlines()
]
return next(l.split()[0] for l in xrandr_output if " connected " in l)
except Exception as e:
sys.exit("could not determine output name", e)
def parse_template(template_path, template, output=""):
"""read videoscreen settings from backup or create a stub file"""
try:
xml_tree = ET.parse(template_path)
except OSError:
print(f"{template_path} not found, creating stub file", file=sys.stderr)
xml_template = ET.fromstring(template.format(output))
xml_tree = ET.ElementTree(xml_template)
finally:
xml_tree.write(template_path)
return xml_tree
def main(output):
guisettings = parse_template(GUISETTINGS, VIDEOSCREEN_TEMPLATE, "Default")
# parse guisettings Etree for display name an backup videoscreen data
root = guisettings.getroot()
old_output = root.find("./setting[@id='videoscreen.monitor']").text
if old_output == output:
print("no changes necessary, exiting", file=sys.stderr)
sys.exit()
# create a minimal guisettings etree
xml_path = os.path.join(CACHE_DIR, f'{old_output}-videoscreen.xml')
base_tree = ET.fromstring('<settings version="2"></settings>')
xml_tree = ET.ElementTree(base_tree)
backup_root = xml_tree.getroot()
# copy videoscreen elements to backup etree
videoscreen_elements = root.xpath(
"./setting[starts-with(@id, 'videoscreen.')]")
for element in videoscreen_elements:
backup_root.append(copy.deepcopy(element))
element.getparent().remove(element)
xml_tree.write(xml_path)
print(f"written backup for {old_output} to {xml_path}", file=sys.stderr)
# change videoscreen node to content of backup file
xml_path = os.path.join(CACHE_DIR, f'{output}-videoscreen.xml')
videodir_xml = parse_template(xml_path, VIDEOSCREEN_TEMPLATE, output)
videodir_root = videodir_xml.getroot()
videoscreen = videodir_root.find("./setting[@id='videoscreen.monitor']")
# copy videoscreen.* elements from Backup
videoscreen_elements = videodir_root.xpath(
"./setting[starts-with(@id, 'videoscreen.')]")
for element in videoscreen_elements:
new_element = copy.deepcopy(element)
root.append(new_element)
guisettings.write(GUISETTINGS)
if __name__ == '__main__':
create_cache_dir()
output = get_output_name()
try:
main(output)
except Exception as e:
print("Could not change videoscreen.* settings:", str(e), file=sys.stderr)

View File

@ -2,11 +2,12 @@
- name: install nfs server packages - name: install nfs server packages
apt: apt:
name: name: '{{ item }}'
- nfs-kernel-server
- nfs-common
state: present state: present
install_recommends: no install_recommends: no
with_items:
- nfs-kernel-server
- nfs-common
- name: create /etc/exports - name: create /etc/exports
template: template:

View File

@ -1,4 +1,4 @@
/srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}) /srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }})
{% for name, path in media_dirs.items() | list %} {% 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 '' }}) {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }})
{% endfor %} {% endfor %}

View File

@ -8,12 +8,13 @@
tags: tags:
- ppa - ppa
- name: install nvidia-396 and other required packages - name: install nvidia-387 and other required packages
apt: apt:
name: name: '{{ item }}'
- nvidia-396
- nvidia-settings
state: present state: present
install_recommends: no install_recommends: no
with_items:
- nvidia-387
- nvidia-settings
tags: tags:
- packages - packages

View File

@ -2,12 +2,13 @@
- name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol - name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol
apt: apt:
name: name: '{{ item }}'
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
state: present state: present
install_recommends: no install_recommends: no
with_items:
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
- name: create /etc/asound.conf with pulseaudio as default device - name: create /etc/asound.conf with pulseaudio as default device
template: template:

View File

@ -1,4 +1,4 @@
{{ ansible_managed | comment }} {{ ansible_managed_file | comment }}
#======================= Global Settings ======================= #======================= Global Settings =======================
@ -69,8 +69,7 @@
# This option controls how unsuccessful authentication attempts are mapped # This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections # to anonymous connections
map to guest = bad password map to guest = bad user
guest account = nobody
{% if samba.windows_compatible %} {% if samba.windows_compatible %}
# disable unix extensions and enable following symlinks # disable unix extensions and enable following symlinks
@ -78,7 +77,7 @@
follow symlinks= yes follow symlinks= yes
wide links= yes wide links= yes
{% endif %} {% endif %}
{% for name, path in media_dirs.items() | list %} {% for name, path in media_dirs.iteritems() %}
[{{ name }}] [{{ name }}]
path = {{ path }} path = {{ path }}
comment = {{ name }} on %h comment = {{ name }} on %h

View File

@ -3,10 +3,11 @@
- name: install samba server - name: install samba server
apt: apt:
name: name: '{{ item }}'
- samba
- samba-common
- samba-common-bin
- tdb-tools
state: present state: present
install_recommends: no install_recommends: no
with_items:
- samba
- samba-common
- samba-common-bin
- tdb-tools

View File

@ -1,4 +0,0 @@
---
# file: roles/serial-ir/defaults/main.yml
serial_ir_device: ttyS0

View File

@ -1,21 +0,0 @@
---
# file: roles/serial-ir/tasks/main.yml
- name: apt | install setserial
apt:
name: setserial
- name: load serial_ir on startup
template:
src: roles/serial-ir/templates/modules-load.d/serial_ir.conf.j2
dest: /etc/modules-load.d/serial_ir.conf
- name: serial_ir module options
template:
src: roles/serial-ir/templates/modprobe.d/serial_ir.conf.j2
dest: /etc/modprobe.d/serial_ir.conf
- name: setserial options
template:
src: roles/serial-ir/templates/serial.conf.j2
dest: /etc/serial.conf

View File

@ -1,12 +0,0 @@
{{ ansible_managed | comment }}
{% if serial_ir_device == "ttyS0" %}
#COM1 equivalent, /dev/ttyS0
options serial_ir irq=4 io=0x3f8
{% elif serial_ir_device == "ttyS1" %}
#COM2 equivalent, /dev/ttyS1
options serial_ir irq=3 io=0x2f8
{% endif %}
{% if serial_ir_device in ("ttyS0", "ttyS1") %}
install serial_ir setserial /dev/{{serial_ir_device}} uart none; /sbin/modprobe --ignore-install serial_ir
{% endif %}

View File

@ -1,3 +0,0 @@
{{ ansible_managed | comment }}
serial_ir

View File

@ -1,9 +0,0 @@
{{ ansible_managed | comment }}
{% if serial_ir_device == "ttyS0" %}
#COM1 equivalent, /dev/ttyS0
/dev/ttyS0 uart none
{% elif serial_ir_device == "ttyS1" %}
#COM2 equivalent, /dev/ttyS1
/dev/ttyS1 uart none
{% endif %}

View File

@ -1,15 +0,0 @@
---
# 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

View File

@ -1,51 +0,0 @@
<?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" />
<command name="Kodi" execute="frontend-dbus-send switchto kodi" />
<plugin name="desktop" />
<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="{{ 'Commands' | translate }}">
<command name="{{ "Safely remove usb mass storage" | translate }}" confirm="yes" execute="/usr/bin/vdr-mounter --unmount-all &amp;> /dev/null" />
<command name="{{ "Update vdr recordings list" | translate }}" execute="/usr/bin/vdr-dbus-send /Recordings recording.Update &amp;> /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 &amp;> /dev/null &amp; " />
</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>

View File

@ -3,12 +3,13 @@
- name: apt | install basic vdr packages - name: apt | install basic vdr packages
apt: apt:
name: name: '{{ item }}'
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
state: present state: present
install_recommends: no install_recommends: no
with_items:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
- name: add svdrp and svdrp-disc to /etc/services - name: add svdrp and svdrp-disc to /etc/services
lineinfile: lineinfile:
dest: /etc/services dest: /etc/services
@ -47,9 +48,11 @@
# TODO: set recdir, user etc. in /etc/vdr/conf.d/ # TODO: set recdir, user etc. in /etc/vdr/conf.d/
- name: apt | install additional vdr plugins - name: apt | install additional vdr plugins
apt: apt:
name: '{{ vdr_plugins | default([]) }}' name: '{{ item }}'
state: present state: present
install_recommends: no install_recommends: no
with_items:
'{{ vdr_plugins | default({}) }}'
notify: [ 'Restart VDR' ] notify: [ 'Restart VDR' ]
- name: ensure vdr is stopped - name: ensure vdr is stopped
systemd: systemd:
@ -66,105 +69,11 @@
mode: 0644 mode: 0644
force: no force: no
- name: "vdr configuration | copy keymacros.conf" - name: "vdr configuration | copy keymacros.conf if it doesn't exist yet"
copy: copy:
src: files/keymacros.conf src: files/keymacros.conf
dest: '{{ vdr.etc_confdir }}/keymacros.conf' dest: '{{ vdr.confdir }}/keymacros.conf'
owner: '{{ vdr.user }}' owner: '{{ vdr.user }}'
group: '{{ vdr.group }}' group: '{{ vdr.group }}'
mode: 0644 mode: 0644
force: no force: no
- name: "vdr configuration | copy channels.conf if it doesn't exist yet"
copy:
src: '{{ vdr_channels_conf }}'
dest: '{{ vdr.confdir }}/channels.conf'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0644
force: no
when: vdr_channels_conf is defined
- name: "vdr configuration | download channels.conf if it doesn't exist yet"
get_url:
url: '{{ vdr_channels_conf_url }}'
dest: '{{ vdr.confdir }}/channels.conf'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0644
force: no
when: vdr_channels_conf is not defined and vdr_channels_conf_url is defined
- name: "vdr configuration | svdrphosts.conf"
template:
src: templates/svdrphosts.conf.j2
dest: '{{ vdr.etc_confdir }}/svdrphosts.conf'
mode: 0644
vars:
svdrphosts: '{{ vdr_svdrphosts | default(vdr_allowed_hosts) }}'
- name: "vdr configuration | /etc/default/vdr"
template:
src: templates/default_vdr.j2
dest: /etc/default/vdr
- name: ensure directory '/etc/vdr/xineliboutput' exists
file:
state: directory
mode: 0775
dest: '/etc/vdr/plugins/xineliboutput'
- name: "vdr configuration | allowed_hosts.conf for xineliboutput"
template:
src: templates/generic_allowed_hosts.conf.j2
dest: '/etc/vdr/plugins/{{ vdr_service }}/allowed_hosts.conf'
mode: 0644
vars:
allowed_hosts: '{{ xineliboutput_allowed_hosts | default(vdr_allowed_hosts) }}'
vdr_service: xineliboutput
- name: "vdr configuration | xineliboutput.conf host settings"
template:
src: templates/xineliboutput.conf.j2
dest: /etc/vdr/conf.avail/xineliboutput.conf
mode: 0644
vars:
allowed_hosts: '{{ xineliboutput_allowed_hosts | default(vdr_allowed_hosts) }}'
- name: ensure directory '/etc/vdr/plugins/vnsiserver' exists
file:
state: directory
mode: 0775
dest: '/etc/vdr/plugins/vnsiserver'
- name: "vdr configuration | allowed_hosts.conf for vnsiserver"
template:
src: templates/generic_allowed_hosts.conf.j2
dest: '/etc/vdr/plugins/{{ vdr_service }}/allowed_hosts.conf'
mode: 0644
vars:
allowed_hosts: '{{ vnsiserver_allowed_hosts | default(vdr_allowed_hosts) }}'
vdr_service: vnsiserver
- name: ensure directory '/etc/vdr/plugins' exists
file:
state: directory
mode: 0775
dest: '/etc/vdr/plugins/'
- name: "vdr configuration | streamdevhosts.conf for streamdev-server"
template:
src: templates/generic_allowed_hosts.conf.j2
dest: '/etc/vdr/plugins/streamdevhosts.conf'
mode: 0644
vars:
allowed_hosts: '{{ streamdev_server_allowed_hosts | default(vdr_allowed_hosts) }}'
vdr_service: streamdev-server
- name: create directory for vdr.service systemd drop-in files
file:
dest: '{{ item }}'
state: directory
with_items:
- "/etc/systemd/system/vdr.service.d/"
- 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

View File

@ -1,7 +0,0 @@
{{ ansible_managed | comment }}
# /etc/default/vdr
#
# See also /usr/share/doc/vdr/README.Debian.gz
#
SHUTDOWNCMD="{{ vdr_shutdown_command }}"

View File

@ -1,22 +0,0 @@
{{ ansible_managed | comment }}
# This file describes a number of host addresses that
# are allowed to connect to the {{ vdr_service }}
# running with the Video Disk Recorder (VDR) on this system.
#
# Syntax:
#
# IP-Address[/Netmask]
#
# Examples:
#
# 192.168.100.0/24 # any host on the local net
# 204.152.189.113 # a specific host
{% if vdr_service == 'streamdev-server' %}
# 239.255.0.0/16 # uncomment for IGMP multicast streaming
{% endif %}
# 0.0.0.0/0 # any host on any net (USE THIS WITH CARE!)
127.0.0.1 # always accept localhost
{% for host_or_subnet in allowed_hosts %}
{{ host_or_subnet }}
{% endfor %}

View File

@ -1,18 +0,0 @@
{{ ansible_managed | comment }}
#
# svdrphosts This file describes a number of host addresses that
# are allowed to connect to the SVDRP port of the Video
# Disk Recorder (VDR) running on this system.
# Syntax:
#
# IP-Address[/Netmask]
#
# Examples:
# 192.168.100.0/24 # any host on the local net
# 204.152.189.113 # a specific host
# 0.0.0.0/0 # any host on any net (USE THIS WITH CARE!)
127.0.0.1 # always accept localhost
{% for host_or_subnet in svdrphosts %}
{{ host_or_subnet }}
{% endfor %}

View File

@ -1,13 +0,0 @@
#
# Command line parameters for vdr-plugin-xineliboutput
#
# For more details see:
# - /usr/share/doc/vdr-plugin-xineliboutput/README.Debian
# - `vdr --help -Pxineliboutput`
# - /usr/share/doc/vdr-plugin-xineliboutput/README
#
[xineliboutput]
--local=none
--primary
--remote={{ "" if allowed_hosts else "127.0.0.1" }}:37890
--truecolor

View File

@ -1,4 +1,4 @@
{{ ansible_managed | comment }} {{ ansible_managed_file | comment }}
# Activate/deactivate ACPIWakeup with yes/no: # Activate/deactivate ACPIWakeup with yes/no:
ACPI_ENABLED="{% if wakeup_method == 'acpiwakeup' %}yes{% else %}no{% endif %}" ACPI_ENABLED="{% if wakeup_method == 'acpiwakeup' %}yes{% else %}no{% endif %}"

View File

@ -28,4 +28,3 @@ vdr:
hide_first_recording_level: false hide_first_recording_level: false
safe_dirnames: true safe_dirnames: true
override_vdr_charset: false override_vdr_charset: false
vdr_allowed_hosts: []

View File

@ -8,7 +8,7 @@
apt_repository: apt_repository:
repo: '{{ item }}' repo: '{{ item }}'
state: present state: present
update_cache: no update_cache: yes
with_items: '{{ repositories }}' with_items: '{{ repositories }}'
tags: tags:
- ppa - ppa

View File

@ -28,34 +28,35 @@
with_first_found: with_first_found:
- files: - files:
- /etc/update-manager/release-upgrades - /etc/update-manager/release-upgrades
errors: ignore skip: true
- name: apt | install basic packages - name: apt | install basic packages
apt: apt:
name: name: '{{ item }}'
- anacron
- acl
- at
- bash-completion
#- biosdevname # caution: may change device names after a minimal installation!
- debconf-utils
- linux-firmware
- psmisc
- python-jmespath
- python-kmodpy
- python-requests
- python-usb
- python3-usb
- software-properties-common
- ssh
- wget
- wpasupplicant
- usbutils
- xfsprogs
- yavdr-i18n
state: present state: present
install_recommends: no install_recommends: no
with_items:
- 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
- name: apt | install extra packages - name: apt | install extra packages
apt: apt:
name: '{{ extra_packages }}' name: '{{ item }}'
state: present state: present
install_recommends: no install_recommends: no
with_items:
'{{ extra_packages }}'

View File

@ -4,11 +4,6 @@
state: directory state: directory
mode: 0755 mode: 0755
- name: touch /etc/yavdr/autoinstalled (this file must exist)
file:
path: /etc/yavdr/autoinstalled
state: touch
- name: create media directories - name: create media directories
file: file:
dest: '{{ item.value }}' dest: '{{ item.value }}'

View File

@ -1,6 +0,0 @@
- 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

View File

@ -6,6 +6,4 @@
- import_tasks: configure_apt.yml - import_tasks: configure_apt.yml
- import_tasks: configure_system.yml - import_tasks: configure_system.yml
- import_tasks: create_directories.yml - import_tasks: create_directories.yml
- import_tasks: create_sudoers.yml
- import_tasks: standby_support.yml
tags: [install] tags: [install]

View File

@ -1,11 +0,0 @@
- name: create /usr/local/bin/module-helper
template:
src: templates/module-helper.j2
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'

View File

@ -1,4 +1,4 @@
{{ ansible_managed | comment('c') }} {{ ansible_managed_file | comment('c') }}
// Recommends are as of now still abused in many packages // Recommends are as of now still abused in many packages
APT::Install-Recommends "0"; APT::Install-Recommends "0";
APT::Install-Suggests "0"; APT::Install-Suggests "0";

View File

@ -1,77 +0,0 @@
#!/usr/bin/env python3
# {{ ansible_managed | comment }}
# 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()

View File

@ -1,21 +0,0 @@
#!/bin/bash
{{ ansible_managed | comment }}
case $1 in
pre)
/bin/systemctl stop vdr
/usr/local/bin/module-helper -u dvb_core
;;
post)
# reload rc-core keytables
[ -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
}
/usr/local/bin/module-helper -r
/bin/systemctl start vdr
;;
esac

View File

@ -1,2 +0,0 @@
{{ vdr.user }} ALL=NOPASSWD: /bin/systemctl --no-block restart vdr.service
{{ vdr.user }} ALL=NOPASSWD: /bin/systemctl --no-block reboot

View File

@ -1,160 +0,0 @@
---
# file: roles/yavdr-desktop/tasks/main.yml
- 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'
- '{{ vdr.home }}/bin'
- 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 }}'
- name: "expand template for vdr's .Xresources"
template:
src: 'templates/.Xresources.j2'
dest: '{{ vdr.home }}/.Xresources'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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 }}'
- 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
- 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 }}'
force: no
- name: set up udiskie
include_tasks: udiskie.yml
- 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
- name: enable and start yavdr-xorg for the vdr user
systemd:
daemon_reload: yes
name: 'yavdr-xorg'
enabled: yes
state: started

View File

@ -1,27 +0,0 @@
- name: install udiskie
apt:
name:
- udiskie
- name: create ~/.config/udiskie
file:
name: '{{ vdr.home }}/.config/udiskie'
state: directory
- name: expand template for udiskie's config.yml
template:
src: templates/udiskie/config.yml.j2
dest: '{{ vdr.home }}/.config/udiskie/config.yml'
- name: expand template for mount helper script
template:
src: templates/udiskie/udiskie_vdr_mount_helper.j2
dest: '{{ vdr.home }}/bin/udiskie_vdr_mount_helper'
mode: 0755
owner: vdr
group: vdr
- name: expand template for udiskie vdr commands
template:
src: templates/udiskie/umount_all.j2
dest: /usr/share/vdr/command-hooks/commands.udiskie.conf

View File

@ -1,3 +0,0 @@
#!/bin/bash
{{ ansible_managed | comment }}
exec openbox-session

View File

@ -1,9 +0,0 @@
#!/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

View File

@ -1,9 +0,0 @@
#!/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

View File

@ -1,10 +0,0 @@
[Unit]
Description=Detect second DISPLAY using xrandr
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=%h/bin/detect-second-display
[Install]
WantedBy=yavdr-desktop.target

View File

@ -1,25 +0,0 @@
#!/bin/bash
{{ ansible_managed | comment }}
program_options:
tray: false # [bool] Enable the tray icon. "auto"
menu: flat # ["flat" | "nested"] Set the
automount: true # [bool] Enable automatic mounting.
notify: true # [bool] Enable notifications.
password_cache: false # [int] Password cache in minutes. Caching is
file_manager: ""
notify_command: "{{ vdr.home }}/bin/udiskie_vdr_mount_helper '{event}' '{device_presentation}' '{mount_path}'"
device_config:
- is_loop: true
ignore: true
- is_external: false
ignore: true
notifications:
device_mounted: 5 # mount notification
device_unmounted: true # unmount notification
device_added: true # device has appeared
device_removed: true # device has disappeared

View File

@ -1,46 +0,0 @@
#!/bin/bash
{{ ansible_managed | comment }}
videodir="{{ vdr.recdir }}"
event="$1"
device_node="$2"
mount_path="$3"
logger -t "mount-notification" "event: $event, device: $device_node, mount_path: $mount_path"
case "$event" in
'device_mounted')
target="${videodir}/$(basename "${mount_path}")"
ln -s -T "$mount_path" "$target" ||
{ logger -t "vdr recordings found" "mountpoint already exists, aborting"; exit; }
# check if we got a vdr recording on the mountpoint
if [ -n $(find "$mount_path" -name "*.rec" -print -quit 2>/dev/null) ]
then
vdr-dbus-send /Skin skin.QueueMessage string:"$mount_path mounted (with recordings)"
svdrpsend updr
else
vdr-dbus-send /Skin skin.QueueMessage string:"$mount_path' mounted"
fi
;;
'device_unmounted')
removed_symlinks=($(find "$videodir" -xtype l -delete -print))
logger -t "device umounted" "remove unneeded symlinks: $(paste -d " " <<< "${removed_symlinks[@]}")"
vdr-dbus-send /Skin skin.QueueMessage string:"$device_node umounted"
svdrpsend updr
;;
'device_removed')
removed_symlinks=($(find "$videodir" -xtype l -delete -print))
[ -z "$device_node" ] && exit
logger -t "device removed" "remove unneeded symlinks: $(paste -d " " <<< "${removed_symlinks[@]}")"
vdr-dbus-send /Skin skin.QueueMessage string:"$device_node removed"
svdrpsend updr
;;
'job_failed')
if [ -n "$mount_path" ]
then
logger -t "umount failed" "could not unmount $mount_path"
else
logger -t "operation failed" 'could not mount(?) '"$device_node"
fi
;;
esac

View File

@ -1,4 +0,0 @@
#!/bin/bash
{{ ansible_managed | comment }}
{{ "Safely remove usb mass storage" | translate }} : echo 'svdrpsend mesg "$(udiskie-umount -a 2>&1 | grep -o "Error unmounting.*")"' | at now

View File

@ -3,16 +3,17 @@
- name: apt | install packages for network services - name: apt | install packages for network services
apt: apt:
name: name: '{{ item }}'
- avahi-daemon
- avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation!
- ethtool
- nfs-common
- vdr-addon-avahi-linker
- wakeonlan
state: present state: present
install_recommends: no install_recommends: no
with_items:
- avahi-daemon
- avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation!
- ethtool
- nfs-common
- vdr-addon-avahi-linker
- wakeonlan
# Does this really work? We need a way to check if an interface supports WOL - Python Skript? # Does this really work? We need a way to check if an interface supports WOL - Python Skript?
# - name: check WOL capabilities of network interfaces # - name: check WOL capabilities of network interfaces

View File

@ -1 +0,0 @@
lircd0_socket: /var/run/lirc/lircd0

View File

@ -3,10 +3,13 @@
- name: apt | install packages for remote support - name: apt | install packages for remote support
apt: apt:
name: name: '{{ item }}'
- yavdr-remote
- lirc
state: present state: present
with_items:
- yavdr-remote
- lirc
- eventlircd
- lircd2uinput
tags: tags:
- packages - packages
@ -23,7 +26,7 @@
tags: tags:
- config - config
- name: stop, mask and disable lircd.socket, lircd.service, lircmd.service and lircd-uinput.service # (the default lirc configuration conflicts with eventlircd) - name: stop, mask and disable lircd.socket, lircd.service and lircd-uinput.service # (the default lirc configuration conflicts with eventlircd)
systemd: systemd:
name: '{{ item }}' name: '{{ item }}'
enabled: no enabled: no
@ -32,21 +35,11 @@
with_items: with_items:
- lircd.service - lircd.service
- lircd.socket - lircd.socket
- lircmd.service
- lircd-uinput.service - lircd-uinput.service
ignore_errors: yes ignore_errors: yes
tags: tags:
- systemd - systemd
- name: apt | install eventlircd and lircd2uinput
apt:
name:
- eventlircd
- lircd2uinput
state: present
tags:
- packages
- name: configure vdr to read from a lircd-compatible socket - name: configure vdr to read from a lircd-compatible socket
template: template:
src: templates/03-vdr-lirc.conf.j2 src: templates/03-vdr-lirc.conf.j2

View File

@ -1,4 +1,3 @@
{{ ansible_managed | comment }}
# #
# Keymaps table # Keymaps table
# #
@ -31,31 +30,6 @@
# devices supported by the linux kernel # devices supported by the linux kernel
#driver table file #driver table file
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
# 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
imon rc-imon-pad /lib/udev/rc_keymaps/rc-imon-pad
# 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
# other devices (which still mostly need a customized keymap for yaVDR)
* rc-adstech-dvb-t-pci adstech_dvb_t_pci * rc-adstech-dvb-t-pci adstech_dvb_t_pci
* rc-alink-dtu-m alink_dtu_m * rc-alink-dtu-m alink_dtu_m
* rc-anysee anysee * rc-anysee anysee
@ -101,9 +75,9 @@ ati_remote rc-medion-x10-digitainer /lib/udev/rc_keymaps/rc-medion-x10-digi
* rc-gadmei-rm008z gadmei_rm008z * rc-gadmei-rm008z gadmei_rm008z
* rc-genius-tvgo-a11mce genius_tvgo_a11mce * rc-genius-tvgo-a11mce genius_tvgo_a11mce
* rc-gotview7135 gotview7135 * rc-gotview7135 gotview7135
* rc-hauppauge /lib/udev/rc_keymaps/rc-hauppauge * rc-hauppauge hauppauge
* rc-imon-mce /lib/udev/rc_keymaps/rc-imon-mce #* rc-imon-mce imon_mce
* rc-imon-pad /lib/udev/rc_keymaps/rc-imon-pad #* rc-imon-pad imon_pad
* rc-iodata-bctv7e iodata_bctv7e * rc-iodata-bctv7e iodata_bctv7e
* rc-it913x-v1 it913x_v1 * rc-it913x-v1 it913x_v1
* rc-it913x-v2 it913x_v2 * rc-it913x-v2 it913x_v2
@ -114,9 +88,9 @@ ati_remote rc-medion-x10-digitainer /lib/udev/rc_keymaps/rc-medion-x10-digi
* rc-leadtek-y04g0051 leadtek_y04g0051 * rc-leadtek-y04g0051 leadtek_y04g0051
* rc-lme2510 lme2510 * rc-lme2510 lme2510
* rc-manli manli * rc-manli manli
#* rc-medion-x10-digitainer medion_x10_digitainer * rc-medion-x10-digitainer medion_x10_digitainer
#* rc-medion-x10-or2x medion_x10_or2x * rc-medion-x10-or2x medion_x10_or2x
#* rc-medion-x10 medion_x10 * rc-medion-x10 medion_x10
* rc-msi-digivox-ii msi_digivox_ii * rc-msi-digivox-ii msi_digivox_ii
* rc-msi-digivox-iii msi_digivox_iii * rc-msi-digivox-iii msi_digivox_iii
* rc-msi-tvanywhere-plus msi_tvanywhere_plus * rc-msi-tvanywhere-plus msi_tvanywhere_plus
@ -137,7 +111,6 @@ ati_remote rc-medion-x10-digitainer /lib/udev/rc_keymaps/rc-medion-x10-digi
* rc-proteus-2309 proteus_2309 * rc-proteus-2309 proteus_2309
* rc-purpletv purpletv * rc-purpletv purpletv
* rc-pv951 pv951 * rc-pv951 pv951
* rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
* rc-real-audio-220-32-keys real_audio_220_32_keys * rc-real-audio-220-32-keys real_audio_220_32_keys
* rc-reddo reddo * rc-reddo reddo
* rc-snapstream-firefly snapstream_firefly * rc-snapstream-firefly snapstream_firefly
@ -156,7 +129,7 @@ ati_remote rc-medion-x10-digitainer /lib/udev/rc_keymaps/rc-medion-x10-digi
* rc-total-media-in-hand-02 total_media_in_hand_02 * rc-total-media-in-hand-02 total_media_in_hand_02
* rc-total-media-in-hand total_media_in_hand * rc-total-media-in-hand total_media_in_hand
* rc-trekstor trekstor * rc-trekstor trekstor
* rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1500 * rc-tt-1500 tt_1500
* rc-twinhan-dtv-cab-ci twinhan_dtv_cab_ci * rc-twinhan-dtv-cab-ci twinhan_dtv_cab_ci
* rc-twinhan1027 twinhan_vp1027_dvbs * rc-twinhan1027 twinhan_vp1027_dvbs
* rc-videomate-k100 videomate_k100 * rc-videomate-k100 videomate_k100
@ -173,9 +146,37 @@ ati_remote rc-medion-x10-digitainer /lib/udev/rc_keymaps/rc-medion-x10-digi
# * * dibusb # found in dibusb-common.c # * * dibusb # found in dibusb-common.c
# * * digitv # found in digitv.c # * * digitv # found in digitv.c
# * * megasky # found in m920x.c # * * megasky # found in m920x.c
# * * tvwalkerir-kbd-i2c # found in m920x.c # * * tvwalkerir-kbd-i2c rc-hauppauge /lib/udev/rc_keymaps/rc-hauppaugetwin # found in m920x.c
# * * pinnacle310e # found in m920x.c # * * pinnacle310e # found in m920x.c
# * * haupp # found in nova-t-usb2.c # * * haupp # found in nova-t-usb2.c
# * * opera1 # found in opera1.c # * * opera1 # found in opera1.c
# * * vp702x # found in vp702x.c # * * vp702x # found in vp702x.c
# * * vp7045 # found in vp7045.c # * * vp7045 # found in vp7045.c
# Hauppauge PVR 350
ir-kbd-i2c rc-hauppauge /lib/udev/rc_keymaps/rc-hauppauge
# imon-pad
imon rc-imon-pad /lib/udev/rc_keymaps/rc-imon-pad
imon rc-imon-mce /lib/udev/rc_keymaps/rc-imon-mce
# TT-1500/1501
* rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1500
budget_ci rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1501
# rc-rc6-mce
* rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
# CIR
ite-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
nuvoton-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
# mceusb
mceusb rc-rc6-mce /lib/udev/rc_keymaps/HOPLOrc6
# 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

View File

@ -1,15 +0,0 @@
preferred_outputs:
- HDMI
- DP
- DVI
- VGA
- TV
preferred_resolutions:
- 7680x4320
- 3840x2160
- 1920x1080
- 1280x720
- 720x576
preferred_refreshrates:
- 50
- 60

View File

@ -56,7 +56,7 @@
- name: disable pulseaudio autospawning - name: disable pulseaudio autospawning
lineinfile: lineinfile:
path: '{{ vdr.home }}/.config/pulse/client.conf' path: '{{ vdr.home }}/.config/pulse/client.conf'
line: 'autospawn = yes' line: 'autospawn = no'
create: yes create: yes
state: present state: present
owner: '{{ vdr.user }}' owner: '{{ vdr.user }}'
@ -66,57 +66,35 @@
template: template:
src: roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 src: roles/yavdr-xorg/templates/systemd/user/tmux.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/tmux.service' dest: '{{ vdr.home }}/.config/systemd/user/tmux.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- name: create wm-exit.service for the session - name: create wm-exit.service for the session
template: template:
src: roles/yavdr-xorg/templates/systemd/user/wm-exit.service.j2 src: roles/yavdr-xorg/templates/systemd/user/wm-exit.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/wm-exit.service' dest: '{{ vdr.home }}/.config/systemd/user/wm-exit.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- name: create detect-second-display.service for the session - name: create detect-second-display.service for the session
template: template:
src: templates/systemd/user/detect-second-display.service.j2 src: templates/systemd/user/detect-second-display.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/detect-second-display.service' dest: '{{ vdr.home }}/.config/systemd/user/detect-second-display.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- name: create openbox-second.service for the session - name: create openbox-second.service for the session
template: template:
src: templates/systemd/user/openbox-second.service.j2 src: templates/systemd/user/openbox-second.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/openbox-second.service' dest: '{{ vdr.home }}/.config/systemd/user/openbox-second.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- name: create osd2web.service for the session - name: create osd2web.service for the session
template: template:
src: templates/systemd/user/osd2web.service.j2 src: templates/systemd/user/osd2web.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/osd2web.service' dest: '{{ vdr.home }}/.config/systemd/user/osd2web.service'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0644
- name: create irexec configuration for the session - name: create irexec configuration for the session
block: block:
- template: - template:
src: templates/systemd/user/irexec.service.j2 src: templates/systemd/user/irexec.service.j2
dest: '{{ vdr.home }}/.config/systemd/user/irexec.service' dest: '{{ vdr.home }}/.config/systemd/user/irexec.service'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- template: - template:
src: templates/.lircrc.j2 src: templates/.lircrc.j2
dest: '{{ vdr.home }}/.lircrc' dest: '{{ vdr.home }}/.lircrc'
mode: 0644
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- name: link /usr/bin/start-desktop to /var/lib/vdr/plugins/desktop/starter - name: link /usr/bin/start-desktop to /var/lib/vdr/plugins/desktop/starter
file: file:

View File

@ -11,11 +11,6 @@
src: "templates/xorg-verbose.conf.j2" src: "templates/xorg-verbose.conf.j2"
dest: "/etc/X11/xorg-verbose.conf" dest: "/etc/X11/xorg-verbose.conf"
- name: "remove intel snippet"
file:
path: /etc/X11/xorg.conf.d/20-intel.conf
state: absent
- name: Stop VDR - name: Stop VDR
systemd: systemd:
name: vdr.service name: vdr.service
@ -23,75 +18,52 @@
enabled: yes enabled: yes
notify: ['Start VDR'] notify: ['Start VDR']
- name: Stop yavdr-xorg
systemd:
name: 'yavdr-xorg'
state: stopped
enabled: yes
notify: ['Start yavdr-xorg']
- name: Stop xlogin - name: Stop xlogin
systemd: systemd:
name: 'xlogin@{{ vdr.user }}.service' name: 'xlogin@{{ vdr.user }}.service'
state: stopped state: stopped
notify: ['Start xlogin']
- name: Stop x - name: Stop x
systemd: systemd:
name: x@vt7.service name: x@vt7.service
state: stopped state: stopped
- name: check /etc/yavdr/autoinstalled if a nvidia driver has been installed - name: Workaround for wrong connector names on first run
lineinfile:
name: /etc/yavdr/autoinstalled
regexp: '.*nvidia.*'
state: absent
check_mode: yes
register: nvidia_driver_detected
- name: set_fact | nvidia_driver_installed
set_fact:
nvidia_driver_installed: '{{ nvidia_driver_detected.changed | bool }}'
- name: unload nouveau driver, replace with nvidia
block: block:
- name: unbind vconsole - name: "wait a little bit before starting x-verbose@vt7.service (needed?)"
shell: echo 0 > /sys/class/vtconsole/vtcon1/bind
- name: "wait a little, so noveau isn't used anymore"
wait_for: wait_for:
timeout: 1 timeout: 10
# unloading the drivers using the modprobe module does not work for some strange reason... - name: "start x-verbose@.service"
- name: unload kms drivers
rmmod:
name: '{{ item }}'
loop:
- nouveau
- ttm
- drm_kms_helper
- drm
- name: load nvidia driver
modprobe:
name: "nvidia"
state: present
- name: "wait a little before starting nvidia-persistenced"
wait_for:
timeout: 1
- name: start nvidia-persistenced
systemd: systemd:
name: "nvidia-persistenced" name: "x-verbose@vt7.service"
state: started state: started
enabled: true enabled: false
masked: false masked: false
daemon_reload: true daemon_reload: true
when:
- nvidia_detected | bool - name: "wait a little bit, so X has some time to start up (needed?)"
- nvidia_driver_installed | bool wait_for:
- '"nouveau" in modules' timeout: 3
- name: "stop x-verbose@vt7.service"
systemd:
name: "x-verbose@vt7.service"
state: stopped
enabled: false
masked: true
tags: first_run
- 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?)"
wait_for:
timeout: 3
- name: "start x-verbose@.service" - name: "start x-verbose@.service"
systemd: systemd:
@ -101,15 +73,12 @@
masked: false masked: false
daemon_reload: true daemon_reload: true
- name: "wait a little, so X has some time to start up" - name: "wait a little bit, so X has some time to start up (needed?)"
wait_for: wait_for:
timeout: 3 timeout: 3
- name: "detect xorg configuration" - name: "detect xorg configuration"
xrandr_facts: action: xrandr_facts
preferred_refreshrates: '{{ preferred_refreshrates }}'
preferred_resolutions: '{{ preferred_resolutions }}'
preferred_outputs: '{{ preferred_outputs }}'
- debug: - debug:
var: xorg.primary var: xorg.primary
@ -118,10 +87,6 @@
var: xorg.secondary var: xorg.secondary
when: xorg.secondary is defined when: xorg.secondary is defined
- debug:
var: drm
when: drm is defined
- name: "stop x-verbose@vt7.service" - name: "stop x-verbose@vt7.service"
systemd: systemd:
name: "x-verbose@vt7.service" name: "x-verbose@vt7.service"
@ -129,45 +94,9 @@
enabled: false enabled: false
masked: true masked: true
#- name: "wait a little bit, so X has some time to shut down (needed?)" - name: "wait a little bit, so X has some time to shut down (needed?)"
# wait_for: wait_for:
# timeout: 3 timeout: 3
- name: save results
block:
- name: ensure facts.d directory exists
file:
state: directory
path: /etc/ansible/facts.d
- name: write xorg variable as local fact
copy:
content: '{{ {"xorg": xorg} | to_nice_json }}'
dest: /etc/ansible/facts.d/xorg.fact
- name: write xrandr variable as local fact
copy:
content: '{{ {"xrandr": xrandr} | to_nice_json }}'
dest: /etc/ansible/facts.d/xrandr.fact
- name: write drm variable as local fact
copy:
content: '{{ {"drm": drm} | to_nice_json }}'
dest: /etc/ansible/facts.d/drm.fact
when:
- xrandr is defined
- xorg is defined
- drm is defined
- name: update xorg, xrandr and drm variables with values from local facts if needed
set_fact:
xorg: '{{ ansible_local.xorg.xorg }}'
xrandr: '{{ ansible_local.xrandr.xrandr }}'
drm: '{{ ansible_local.drm.drm }}'
when:
- xrandr is undefined
- xorg is undefined
- drm is undefined
# TODO: expand template for xorg.conf (or snippets) # TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver # with respect for the available graphics card driver
@ -181,16 +110,4 @@
dest: /etc/X11/xorg.conf dest: /etc/X11/xorg.conf
backup: yes backup: yes
when: when:
- nvidia_detected | bool - nvidia_detected
- name: intel xorg config snippet
template:
src: templates/20-intel.conf.j2
dest: /etc/X11/xorg.conf.d/20-intel.conf
when:
- intel_detected | bool and not nvidia_detected | bool
- name: server flags config snippet to disable screen blanking
template:
src: templates/10-serverflags.conf.j2
dest: /etc/X11/xorg.conf.d/10-serverflags.conf

View File

@ -4,3 +4,5 @@
tags: [install,update] tags: [install,update]
- import_tasks: detect-xorg.yml - import_tasks: detect-xorg.yml
tags: [xorg.detect,install] tags: [xorg.detect,install]
- import_tasks: desktop-session.yml
tags: [install,update]

View File

@ -15,11 +15,6 @@
src: templates/vdr-xorg.conf src: templates/vdr-xorg.conf
dest: /etc/systemd/system/vdr.service.d/vdr-xorg.conf dest: /etc/systemd/system/vdr.service.d/vdr-xorg.conf
- 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
- name: systemd-drop-in | start x@.service before xlogin@.service - name: systemd-drop-in | start x@.service before xlogin@.service
template: template:
src: templates/x@service.d/xlogin.conf.j2 src: templates/x@service.d/xlogin.conf.j2
@ -30,6 +25,11 @@
src: templates/systemd/vdr-environ.j2 src: templates/systemd/vdr-environ.j2
dest: /etc/systemd/system/vdr.service.d/load-environ.conf dest: /etc/systemd/system/vdr.service.d/load-environ.conf
- 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
- name: systemd-drop-in | user@{{ vdr.uid }}.service depends on x@vt7.service - name: systemd-drop-in | user@{{ vdr.uid }}.service depends on x@vt7.service
template: template:
src: templates/user@666.service.d/x-dependency.conf.j2 src: templates/user@666.service.d/x-dependency.conf.j2
@ -41,15 +41,8 @@
line: '{{ item }}' line: '{{ item }}'
with_items: with_items:
- '-D' - '-D'
- '-w alsa-driver-broken'
# - '-a pulse' # do we need this with our existing asound.conf? # - '-a pulse' # do we need this with our existing asound.conf?
- name: vdr-config | use vaapi for softhddevice if we got an intel IGP
lineinfile:
path: /etc/vdr/conf.avail/softhddevice.conf
line: '-v va-api'
state: '{{ "present" if (not nvidia_detected and intel_detected) else "absent" }}'
- name: add a login shell for the user vdr - name: add a login shell for the user vdr
user: user:
name: '{{ vdr.user }}' name: '{{ vdr.user }}'
@ -61,51 +54,44 @@
- name: apt | install packages for xorg - name: apt | install packages for xorg
apt: apt:
name: name: '{{ item }}'
- 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
state: present state: present
with_items:
- xlogin
- 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
- name: apt | install packages for Intel IGP - name: download yavdr logo
apt: block:
name: - file:
- xserver-xorg-video-intel dest: '/usr/share/yavdr/images'
- i965-va-driver-shaders state: directory
state: present
when: intel_detected | bool and not nvidia_detected | bool
- name: Install yaVDR Media (e.g. Backgrounds) - get_url:
apt: url: 'https://github.com/yavdr/yavdr-base/raw/master/images/yavdr_logo.png'
name: yavdr-media dest: '/usr/share/yavdr/images/yavdr_logo.png'
- name: command | write keyboard configuration to /etc/X11/xorg.conf.d/00-keyboard.conf - name: command | write keyboard configuration to /etc/X11/xorg.conf.d/00-keyboard.conf
command: write-x11-keyboard-config command: write-x11-keyboard-config
args: creates: /etc/X11/xorg.conf.d/00-keyboard.conf
creates: /etc/X11/xorg.conf.d/00-keyboard.conf
# NOTE: write-x11-keyboard-config is in the xlogin package # NOTE: write-x11-keyboard-config is in the xlogin package
# Ubuntu's systemd is patched, so it does not create the file automatically # Ubuntu's systemd is patched, so it does not create the file automatically
- 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
- name: apt | install desktop programs - name: apt | install desktop programs
apt: apt:
name: name: '{{ item }}'
- xterm
- firefox
- kiosk-browser
state: present state: present
with_items:
- xterm
- firefox
- kiosk-browser

Some files were not shown because too many files have changed in this diff Show More