Compare commits

..

No commits in common. "bionic" and "autoinstall-firmware-dvbsky-s952" have entirely different histories.

124 changed files with 3246 additions and 13143 deletions

File diff suppressed because it is too large Load Diff

4601
Manual.org

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +1,12 @@
# 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 16.04.x 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 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 +0,0 @@
[defaults]
callback_plugins = plugins/callbacks
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

@ -1,35 +0,0 @@
# Copyright (c) 2017 Ansible Project
# 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
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'yavdr'
}
import gettext
from ansible.errors import AnsibleFilterError
from ansible.utils import helpers
from ansible.module_utils._text import to_text
def translate_yavdr(text):
gettext.textdomain('yavdr')
try:
return to_text(gettext.gettext(text))
except:
return to_text(text)
# ---- Ansible filters ----
class FilterModule(object):
''' URI filter '''
def filters(self):
return {
'translate': translate_yavdr
}

View File

@ -1,67 +1,40 @@
--- ---
# file: group_vars/all # file: group_vars/all
branch: experimental # this is the standard text to put in templates
ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***"
branch: unstable
ppa_owner: 'ppa:yavdr' ppa_owner: 'ppa:yavdr'
# add the following PPAs # add the following PPAs
repositories: repositories:
- '{{ ppa_owner }}/{{branch}}-main' - '{{ ppa_owner }}/main'
- '{{ ppa_owner }}/unstable-main'
- '{{ ppa_owner }}/{{branch}}-vdr' - '{{ ppa_owner }}/{{branch}}-vdr'
- '{{ ppa_owner }}/{{branch}}-yavdr'
- '{{ ppa_owner }}/{{branch}}-kodi' - '{{ ppa_owner }}/{{branch}}-kodi'
- 'ppa:frodo-vdr/experimental-vdr-yavdr'
#- '{{ ppa_owner }}/{{branch}}-yavdr'
# 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
video: /srv/video video: /srv/audio
pictures: /srv/picture pictures: /srv/picture
files: /srv/files files: /srv/files
backups: /srv/backups backups: /srv/backups
@ -79,24 +52,10 @@ extra_packages:
- tree - tree
- vim - vim
- w-scan - w-scan
- t2scan
- 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 nosplash
# 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 or as root"
exit exit
fi fi
apt-get -y install software-properties-common
# Add repository for ansible
add-apt-repository -y ppa:ansible/ansible
# 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 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=install

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 = '''
--- ---
@ -52,11 +52,11 @@ EXAMPLES = '''
acpi_power_modes: True acpi_power_modes: True
- debug: - debug:
var: usb var: usb
- debug: - debug
var: pci var: pci
- debug: - debug
var: modules var: modules
- debug: - debug
var: gpus var: gpus
''' '''
@ -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)
@ -135,10 +134,6 @@ def main():
pci_devices = [] pci_devices = []
modules = [] modules = []
gpus = [] gpus = []
nvidia_detected = False
intel_detected = False
amd_detected = False
virtualbox_detected = False
acpi_power_modes = [] acpi_power_modes = []
if collect_usb: if collect_usb:
@ -153,18 +148,12 @@ def main():
if collect_gpus: if collect_gpus:
gpus = format_gpu_device_list(get_pci_devices()) gpus = format_gpu_device_list(get_pci_devices())
nvidia_detected = any((True for gpu in gpus if gpu['VendorName'] == 'nvidia'))
intel_detected = any((True for gpu in gpus if gpu['VendorName'] == 'intel'))
amd_detected = any((True for gpu in gpus if gpu['VendorName'] == 'amd'))
virtualbox_detected = any((True for gpu in gpus if gpu['VendorName'] == 'virtualbox'))
if collect_acpi_power_modes: if collect_acpi_power_modes:
acpi_power_modes = list_acpi_power_modes() acpi_power_modes = list_acpi_power_modes()
data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus, data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus,
'acpi_power_modes': acpi_power_modes, 'nvidia_detected': nvidia_detected, 'acpi_power_modes': acpi_power_modes}
'intel_detected': intel_detected, 'amd_detected': amd_detected,
'virtualbox_detected': virtualbox_detected}
module.exit_json(changed=False, ansible_facts=data, msg=data) module.exit_json(changed=False, ansible_facts=data, msg=data)

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,40 +3,29 @@ 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
default: ":0" default: ":0"
description: description:
- the DISPLAY variable to use when calling xrandr - the DISPLAY variable to use when calling xrandr
preferred_outputs: preferred_outpus:
required: False required: False
default: ["HDMI", "DP", "eDP", "DVI", "VGA", "TV", "Virtual"] default: ["HDMI", "DP", "DVI", "VGA", "TV": 0]
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
@ -137,7 +118,6 @@ def sort_mode(mode):
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 = {}
@ -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,64 +171,32 @@ 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:
data = subprocess.check_output("parse-edid < {}".format(edid),
shell=True, universal_newlines=True)
except subprocess.CalledProcessError:
pass
else:
for line in data.splitlines(): for line in data.splitlines():
line = line.strip()
if "VendorName" in line: if "VendorName" in line:
vendor = line.split('"')[1] vendor = line.strip().split('"')[1]
if "ModelName" in line: if "ModelName" in line:
model = line.split('"')[1] model = line.strip().split('"')[1]
if "Modeline" in line: return vendor, model
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:
# nvidia-smi is not installed
pass
else: else:
for row in csv.DictReader(data.splitlines(), delimiter=',', skipinitialspace=True): for row in csv.DictReader(data.splitlines(), delimiter=',', skipinitialspace=True):
name = row['name'] name = row['name']
@ -262,77 +210,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 +222,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 +238,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,48 +0,0 @@
"""
This module implements an Ansible plugin that is triggered at the start of a playbook.
The plugin dynamically generates a tag for each role. Each tag has the same name as its role.
The advantage of this is that it saves you some boilerplate, because you don't have to wrap
all tasks of a role in an additional block and assign a tag to that.
Additionally, it works automatically when you add new roles to your playbook.
Usage is exactly the same as without this plugin:
ansible-playbook --tags=some_tag provision.yml
Here, the "some_tag" tag was generated dynamically (assuming there is a "some_tag" role).
Installation:
1. Place this file in `plugins/callbacks/auto_tags.py` (relative to your playbook root)
2. Add the following two lines to your `ansible.cfg` file:
callback_plugins = plugins/callbacks
callback_whitelist = auto_tags
"""
from __future__ import print_function
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
"""
Ansible supports several types of plugins. We are using the *callback* type here, since
it seemed the best choice for our use case, because it allows you to hook into the start
of a playbook.
"""
def v2_playbook_on_start(self, playbook):
"""
Dynamically add a tag of the same name to each role.
Note: Plays, roles, task_blocks and tasks can have tags.
"""
plays = playbook.get_plays()
# Note: Although identical roles are shared between plays we cannot deduplicate them,
# since Ansible treats them as different objects internally
roles = [role for play in plays for role in play.get_roles()]
# Note: Tags for roles are set dynamically in `_load_role_data` instead of in __init__
# I don't know why they do that.
for role in roles:
role_name = role._role_name
if role_name not in role.tags:
role.tags += [role_name]

View File

@ -1,4 +0,0 @@
---
dependencies:
- { role: collect-facts }
- { 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-irman
apt:
name: lirc-drv-irman
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: '"04d8:f844" in usb'

View File

@ -1,21 +0,0 @@
{{ ansible_managed | comment }}
[lircd]
nodaemon = False
driver = irman
device = /dev/irman
output = /var/run/lirc/lircd0
pidfile = /var/run/lirc/lircd0.pid
plugindir = /usr/lib/x86_64-linux-gnu/lirc/plugins
permission = 666
allow-simulate = No
repeat-max = 600
#loglevel = 6
#release = true
#release_suffix = _EVUP
#logfile = ...
#driver-options = ...
[lircmd]
uinput = 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

@ -1,12 +1,8 @@
--- ---
# file roles/autoinstall-dvbsddevice/tasks/main.yml # file roles/autoinstall-dvbsddevice/tasks/main.yml
# TODO: install firmware
- 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

@ -3,11 +3,12 @@
- name: determine needed firmware files by device ids - name: determine needed firmware files by device ids
block: block:
- name: add firmware files for DVBSky if a card has been detected - name: add firmware for DVBSky S952 V3 to variable dvbsky_firmware_files if a card has been detected
set_fact: set_fact:
dvbsky_firmware_files: ['dvb-demod-m88ds3103.fw', 'dvb-demod-m88rs6000.fw', 'dvb-tuner-si2158-a20-01.fw', 'dvb-demod-si2168-a20-01.fw', 'dvb-demod-si2168-a30-01.fw', 'dvb-demod-si2168-b40-01.fw', 'dvb-fe-ds300x.fw', 'dvb-fe-ds3103.fw', 'dvb-fe-rs6000.fw'] dvbsky_firmware_files: "{{dvbsky_firmware_files}} + ['dvb-demod-m88rs6000.fw']"
when: when:
- '"1ade:3038" in pci' - '"1ade:3038" in pci'
- ansible_distribution_version >= '15.04' #driver only included since Kernel 3.19
when: when:
- not dvbsky_firmware_files - not dvbsky_firmware_files
@ -35,7 +36,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

@ -1,16 +1,15 @@
--- ---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml # file roles/autoinstall-ubuntu-drivers/tasks/main.yml
- name: apt | install ubuntu-drivers-common
- name: autoinstall ubuntu-drivers-common
block:
- name: apt | install ubuntu-drivers-common
apt: apt:
name: ubuntu-drivers-common name: ubuntu-drivers-common
state: present state: present
- name: use ubuntu-drivers to install additional drivers automatically - name: ensure /etc/yavdr exists
file:
path: /etc/yavdr
state: directory
mode: 0755
- name: let ubuntu-drivers automatically install additional drivers
command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall
when: (ansible_virtualization_type != "virtualbox" and ansible_virtualization_role != "guest")
# ubuntu-drivers-common tries to autoinstall
# conflicting packages for virtualbox in Ubuntu 16.04 and 18.04 :(
# also alternates between virtualbox-guest-dkms and virtualbox-guest-dkms-hwe on successive runs

View File

@ -1,41 +0,0 @@
---
# file roles/autoinstall-virtualbox-guest/tasks/main.yml
- name: collect facts about installed packages
package_facts:
manager: "apt"
- name: install virtualbox guest additions
block:
- name: install packages
apt:
state: present
name:
- dkms
- '{{ "virtualbox-guest-x11-hwe" if "xserver-xorg-hwe-18.04" in ansible_facts.packages else "virtualbox-guest-x11" }}'
- '{{ "virtualbox-guest-dkms-hwe" if "linux-generic-hwe-18.04" in ansible_facts.packages else "virtualbox-guest-dkms" }}'
# TODO: set xineliboutput as frontend
when:
- ansible_virtualization_type == "virtualbox"
- ansible_virtualization_role == "guest"
- ansible_distribution == "Ubuntu"
- 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

@ -5,8 +5,6 @@
modules: True modules: True
gpus: True gpus: True
acpi_power_modes: True acpi_power_modes: True
tags:
- always
- debug: - debug:
var: '{{ item }}' var: '{{ item }}'
@ -17,23 +15,3 @@
- gpus - gpus
- modules - modules
- acpi_power_modes - acpi_power_modes
- nvidia_detected
- intel_detected
- amd_detected
- virtualbox_detected
- name: get detailed PCI device information
pci_facts:
tags:
- always
- debug:
var: pci_devices
verbosity: 1
- name: known vdr output plugins
set_fact:
vdr_output_plugins:
- softhddevice
- xineliboutput
- xine

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 }}'
state: present
install_recommends: no
with_items:
- kodi - kodi
- kodi-pvr-vdr-vnsi - kodi-pvr-vdr-vnsi
- python3-lxml - kodi-eventclients-xbmc-send
state: present
install_recommends: no
- name: apt | install kodi-send (team-xbmc PPA)
apt:
name: "kodi-eventclients-xbmc-send" # 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

@ -6,7 +6,7 @@ Type=simple
PassEnvironment=DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS PassEnvironment=DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS
ExecStartPre=-/usr/bin/set-kodi-display 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 /usr/bin/pgrep kodi; do sleep 1; done; sleep 1"
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

@ -5,15 +5,12 @@
repo: 'ppa:graphics-drivers/ppa' repo: 'ppa:graphics-drivers/ppa'
state: present state: present
update_cache: yes update_cache: yes
tags:
- 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
tags: with_items:
- packages - nvidia-387
- nvidia-settings

View File

@ -1,13 +1,13 @@
--- ---
- name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol - name: apt | install pulseaudio and pavucontrol
apt: apt:
name: name: '{{ item }}'
- pulseaudio
- pavucontrol
- vdr-plugin-pulsecontrol
state: present state: present
install_recommends: no install_recommends: no
with_items:
- pulseaudio
- pavucontrol
- 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 }}'
state: present
install_recommends: no
with_items:
- samba - samba
- samba-common - samba-common
- samba-common-bin - samba-common-bin
- tdb-tools - tdb-tools
state: present
install_recommends: no

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 }}'
state: present
install_recommends: no
with_items:
- vdr - vdr
- vdrctl - vdrctl
- vdr-plugin-dbus2vdr - vdr-plugin-dbus2vdr
state: present
install_recommends: no
- 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
@ -29,10 +30,11 @@
blockinfile: blockinfile:
dest: /etc/vdr/conf.d/04-vdr-hide-first-recordinglevel.conf dest: /etc/vdr/conf.d/04-vdr-hide-first-recordinglevel.conf
create: true create: true
state: "{{ 'present' if vdr.hide_first_recording_level else 'absent' }}"
block: | block: |
[vdr] [vdr]
--hide-first-recording-level --hide-first-recording-level
when:
vdr.hide_first_recording_level
- name: create local dir in recdir - name: create local dir in recdir
file: file:
@ -47,9 +49,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 +70,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,3 +0,0 @@
{{ansible_managed | comment }}
[Unit]
After=network-online.target

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

@ -2,12 +2,14 @@
# file roles/wakeup/tasks/main.yml # file roles/wakeup/tasks/main.yml
- name: install and configure vdr-addon-acpiwakeup - name: install and configure vdr-addon-acpiwakeup
apt: block:
- apt:
name: vdr-addon-acpiwakeup name: vdr-addon-acpiwakeup
state: present state: present
when: wakeup_method == "acpiwakeup"
- name: expand template for /etc/vdr/vdr-addon-acpiwakeup.conf - lineinfile:
template: path: /etc/vdr/vdr-addon-acpiwakeup.conf
src: templates/vdr-addon-acpiwakeup.conf.j2 regexp: '^ACPI_ENABLED='
dest: /etc/vdr/vdr-addon-acpiwakeup.conf line: 'ACPI_ENABLED=true'
when: wakeup_method == "acpiwakeup"

View File

@ -1,16 +0,0 @@
{{ ansible_managed | comment }}
# Activate/deactivate ACPIWakeup with yes/no:
ACPI_ENABLED="{% if wakeup_method == 'acpiwakeup' %}yes{% else %}no{% endif %}"
# How many minutes should the machine wake up before the timer starts:
ACPI_START_AHEAD=5
# If you want your VDR machine to wakeup in regular intervals (i.e. for
# updating EPG data), specify the days of the week and the wakeup time.
#
# Days of the week for regular wakeup (not set=Disabled, 1=Monday...7=Sunday)
# ACPI_REGULAR_DAYS="1 2 3 4 5 6 7"
# Wakeup time
#ACPI_REGULAR_TIME=01:00 # HH:MM

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,10 +8,8 @@
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:
- ppa
- name: run apt-get dist-upgrade - name: run apt-get dist-upgrade
apt: apt:

View File

@ -24,14 +24,12 @@
state: present state: present
regexp: '^(Prompt=).*$' regexp: '^(Prompt=).*$'
line: '\1never' line: '\1never'
ignore_errors: yes
with_first_found:
- files:
- /etc/update-manager/release-upgrades
errors: ignore
- name: apt | install basic packages - name: apt | install basic packages
apt: apt:
name: name: '{{ item }}'
state: present
install_recommends: no
with_items:
- anacron - anacron
- acl - acl
- at - at
@ -40,7 +38,6 @@
- debconf-utils - debconf-utils
- linux-firmware - linux-firmware
- psmisc - psmisc
- python-jmespath
- python-kmodpy - python-kmodpy
- python-requests - python-requests
- python-usb - python-usb
@ -51,11 +48,10 @@
- wpasupplicant - wpasupplicant
- usbutils - usbutils
- xfsprogs - xfsprogs
- yavdr-i18n
state: present
install_recommends: no
- 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

@ -1,14 +1,3 @@
- name: ensure /etc/yavdr exists
file:
path: /etc/yavdr
state: directory
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,16 +0,0 @@
xterm*background: Black
xterm*foreground: grey
XTerm*locale: true
XTerm*metaSendsEscape: true
XTerm*eightBitInput: false
XTerm*backarrowKey: false
XTerm*ttyModes: erase ^?
Xterm*saveLines: 4096
XTerm.vt100.metaSendsEscape: true
XTerm.vt100.geometry: 80x32
XTerm.vt100.renderFont: true
xterm*faceName: xft:DejaVu Sans Mono
xterm*faceSize: 14
xterm*renderFont: true
XTerm.vt100.faceName: xft:DejaVu Sans Mono:size=12:antialias=false
XTerm.vt100.font: 7x13

View File

@ -1,5 +0,0 @@
begin
prog = irexec
button = KEY_HOME
config = frontend-dbus-send switchbetween kodi vdr
end

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,9 +0,0 @@
[Unit]
Description=LIRC command handler
[Service]
Type=simple
ExecStart=/usr/bin/irexec %h/.lircrc
[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

@ -1,9 +1,12 @@
--- ---
# this playbook sets up network services for a yaVDR installation # this playbook sets up network services for a yaVDR installation
- name: apt | install packages for network services - name: apt |install packages for network services
apt: apt:
name: name: '{{ item }}'
state: present
install_recommends: no
with_items:
- avahi-daemon - avahi-daemon
- avahi-utils - avahi-utils
#- biosdevname # caution: this may change device names after a minimal installation! #- biosdevname # caution: this may change device names after a minimal installation!
@ -11,8 +14,6 @@
- nfs-common - nfs-common
- vdr-addon-avahi-linker - vdr-addon-avahi-linker
- wakeonlan - wakeonlan
state: present
install_recommends: no
# 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

@ -1,29 +1,22 @@
--- ---
# This role is used to set up the yaVDR remote control configuration. # This role is used to set up the yaVDR remote control configuration.
- name: apt | install packages for remote support - name: apt | install yavdr-remote
apt: apt:
name: name: yavdr-remote
- yavdr-remote
- lirc
state: present state: present
tags:
- packages
- name: add systemd drop-in for lircd to use lircd2uinput - name: apt | install eventlircd
block: apt:
- name: create directory /etc/systemd/system/lircd.service.d/ name: eventlircd
file: state: present
path: /etc/systemd/system/lircd.service.d/
state: directory
- name: expand template for /etc/systemd/system/lircd.service.d/lircd2uinput.conf
template:
src: templates/lircd.service.d/lircd2uinput.conf.j2
dest: /etc/systemd/system/lircd.service.d/lircd2uinput.conf
tags:
- config
- name: stop, mask and disable lircd.socket, lircd.service, lircmd.service and lircd-uinput.service # (the default lirc configuration conflicts with eventlircd) - name: apt | install lirc
apt:
name: lirc
state: present
- 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,33 +25,20 @@
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:
- 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
dest: /etc/vdr/conf.d/03-vdr-lirc.conf dest: /etc/vdr/conf.d/03-vdr-lirc.conf
notify: ['Restart VDR'] notify: ['Restart VDR']
tags:
- config
- name: expand template for /etc/rc_maps.cfg # TODO: upload lircd2uinput package to PPA
template: #- name: install lircd2uinput
src: templates/rc_maps.cfg.j2 # tag: install
dest: /etc/rc_maps.cfg # apt:
notify: ['Trigger Udev'] # name: lircd2uinput
tags: # state: present
- config # when:
# install_eventlircd is defined and install_eventlircd

View File

@ -1,3 +0,0 @@
[Service]
ExecStartPost=/usr/bin/lircd2uinput-add /var/run/lirc/lircd0
ExecStopPost=/usr/bin/lircd2uinput-remove /var/run/lirc/lircd0

View File

@ -1,181 +0,0 @@
{{ ansible_managed | comment }}
#
# Keymaps table
#
# This table creates an association between a keycode file and a kernel
# driver. It can be used to automatically override a keycode definition.
#
# Although not yet tested, it is mented to be added at udev.
#
# To use, you just need to run:
# ./ir-keytable -a
#
# Or, if the remote is not the first device:
# ./ir-keytable -a -s rc1 # for RC at rc1
#
# Format:
# driver - name of the driver provided via uevent - use * for any driver
# table - RC keymap table, provided via uevent - use * for any table
# file - file name. If directory is not specified, it will default to
# /etc/rc_keymaps.
# For example:
# driver table file
# cx8800 * ./keycodes/rc5_hauppauge_new
# * rc-avermedia-m135a-rm-jx ./keycodes/kworld_315u
# saa7134 rc-avermedia-m135a-rm-jx ./keycodes/keycodes/nec_terratec_cinergy_xs
# em28xx * ./keycodes/kworld_315u
# * * ./keycodes/rc5_hauppauge_new
# Table to automatically load the rc maps for the bundled IR's provided with the
# devices supported by the linux kernel
#driver table file
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-alink-dtu-m alink_dtu_m
* rc-anysee anysee
* rc-apac-viewcomp apac_viewcomp
* rc-asus-pc39 asus_pc39
* rc-asus-ps3-100 asus_ps3_100
* rc-ati-tv-wonder-hd-600 ati_tv_wonder_hd_600
* rc-ati-x10 ati_x10
* rc-avermedia-a16d avermedia_a16d
* rc-avermedia-cardbus avermedia_cardbus
* rc-avermedia-dvbt avermedia_dvbt
* rc-avermedia-m135a avermedia_m135a
* rc-avermedia-m733a-rm-k6 avermedia_m733a_rm_k6
* rc-avermedia-rm-ks avermedia_rm_ks
* rc-avermedia avermedia
* rc-avertv-303 avertv_303
* rc-azurewave-ad-tu700 azurewave_ad_tu700
* rc-behold-columbus behold_columbus
* rc-behold behold
* rc-budget-ci-old budget_ci_old
* rc-cec cec
* rc-cinergy-1400 cinergy_1400
* rc-cinergy cinergy
* rc-delock-61959 delock_61959
* rc-dib0700-nec dib0700_nec
* rc-dib0700-rc5 dib0700_rc5
* rc-digitalnow-tinytwin digitalnow_tinytwin
* rc-digittrade digittrade
* rc-dm1105-nec dm1105_nec
* rc-dntv-live-dvb-t dntv_live_dvb_t
* rc-dntv-live-dvbt-pro dntv_live_dvbt_pro
* rc-dtt200u dtt200u
* rc-dvbsky dvbsky
* rc-em-terratec em_terratec
* rc-encore-enltv-fm53 encore_enltv_fm53
* rc-encore-enltv encore_enltv
* rc-encore-enltv2 encore_enltv2
* rc-evga-indtube evga_indtube
* rc-eztv eztv
* rc-flydvb flydvb
* rc-flyvideo flyvideo
* rc-fusionhdtv-mce fusionhdtv_mce
* rc-gadmei-rm008z gadmei_rm008z
* rc-genius-tvgo-a11mce genius_tvgo_a11mce
* rc-gotview7135 gotview7135
* rc-hauppauge /lib/udev/rc_keymaps/rc-hauppauge
* rc-imon-mce /lib/udev/rc_keymaps/rc-imon-mce
* rc-imon-pad /lib/udev/rc_keymaps/rc-imon-pad
* rc-iodata-bctv7e iodata_bctv7e
* rc-it913x-v1 it913x_v1
* rc-it913x-v2 it913x_v2
* rc-kaiomy kaiomy
* rc-kworld-315u kworld_315u
* rc-kworld-pc150u kworld_pc150u
* rc-kworld-plus-tv-analog kworld_plus_tv_analog
* rc-leadtek-y04g0051 leadtek_y04g0051
* rc-lme2510 lme2510
* rc-manli manli
#* rc-medion-x10-digitainer medion_x10_digitainer
#* rc-medion-x10-or2x medion_x10_or2x
#* rc-medion-x10 medion_x10
* rc-msi-digivox-ii msi_digivox_ii
* rc-msi-digivox-iii msi_digivox_iii
* rc-msi-tvanywhere-plus msi_tvanywhere_plus
* rc-msi-tvanywhere msi_tvanywhere
* rc-nebula nebula
* rc-nec-terratec-cinergy-xs nec_terratec_cinergy_xs
* rc-norwood norwood
* rc-npgtech npgtech
* rc-pctv-sedna pctv_sedna
* rc-pinnacle-color pinnacle_color
* rc-pinnacle-grey pinnacle_grey
* rc-pinnacle-pctv-hd pinnacle_pctv_hd
* rc-pixelview-002t pixelview_002t
* rc-pixelview-mk12 pixelview_mk12
* rc-pixelview-new pixelview_new
* rc-pixelview pixelview
* rc-powercolor-real-angel powercolor_real_angel
* rc-proteus-2309 proteus_2309
* rc-purpletv purpletv
* rc-pv951 pv951
* rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
* rc-real-audio-220-32-keys real_audio_220_32_keys
* rc-reddo reddo
* rc-snapstream-firefly snapstream_firefly
* rc-streamzap streamzap
* rc-su3000 su3000
* rc-tbs-nec tbs_nec
* rc-technisat-ts35 technisat_ts35
* rc-technisat-usb2 technisat_usb2
* rc-terratec-cinergy-c-pci terratec_cinergy_c_pci
* rc-terratec-cinergy-s2-hd terratec_cinergy_s2_hd
* rc-terratec-cinergy-xs terratec_cinergy_xs
* rc-terratec-slim-2 terratec_slim_2
* rc-terratec-slim terratec_slim
* rc-tevii-nec tevii_nec
* rc-tivo tivo
* rc-total-media-in-hand-02 total_media_in_hand_02
* rc-total-media-in-hand total_media_in_hand
* rc-trekstor trekstor
* rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1500
* rc-twinhan-dtv-cab-ci twinhan_dtv_cab_ci
* rc-twinhan1027 twinhan_vp1027_dvbs
* rc-videomate-k100 videomate_k100
* rc-videomate-s350 videomate_s350
* rc-videomate-tv-pvr videomate_tv_pvr
* rc-winfast-usbii-deluxe winfast_usbii_deluxe
* rc-winfast winfast
# * * a800 # found in a800.c
# * * af9005 # found in af9005-remote.c
# * * cinergyt2 # found in cinergyT2-core.c
# * * dvico_mce # found in cxusb.c
# * * dvico_portable # found in cxusb.c
# * * d680_dmb # found in cxusb.c
# * * dibusb # found in dibusb-common.c
# * * digitv # found in digitv.c
# * * megasky # found in m920x.c
# * * tvwalkerir-kbd-i2c # found in m920x.c
# * * pinnacle310e # found in m920x.c
# * * haupp # found in nova-t-usb2.c
# * * opera1 # found in opera1.c
# * * vp702x # found in vp702x.c
# * * vp7045 # found in vp7045.c

View File

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

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