Compare commits

...

233 Commits

Author SHA1 Message Date
12f0b831b8 add frodo entries 2019-05-28 09:33:10 +02:00
Alexander Grothe
2468270ee6 Use multiline string instead of dict 2019-05-23 17:27:47 +02:00
Alexander Grothe
9e58e0b4e4 Fix deprecation warnings for Ansible 2.8 2019-05-23 17:10:19 +02:00
Alexander Grothe
9648bae2bd Fix variable name
so it won't clash with the existing nvidia_detected variable (which is
based on PCI(e) devices.
2019-05-23 16:36:42 +02:00
Alexander Grothe
6cf02c5304 Improve check for nvidia driver
so it works also on remote machines
2019-05-23 16:27:05 +02:00
Alexander Grothe
c96c146ff2 Update Manual.org 2019-05-20 21:36:57 +02:00
Alexander Grothe
5f7414c008 Fix syntax, remove superfluous if 2019-05-18 12:00:22 +02:00
Alexander Grothe
23e54c67a7 Ensure a unicode string is returned 2019-05-16 13:07:40 +02:00
Alexander Grothe
c522d19c2b Set state to directoy 2019-05-16 11:57:07 +02:00
Alexander Grothe
adab0137d2 Fix: Add whitespace after comments 2019-05-15 20:05:32 +02:00
Alexander Grothe
5f5dec80ea remove double shebang in mount helper script 2019-05-15 20:00:41 +02:00
Alexander Grothe
e2e7ec8a0c Update Manual.html 2019-05-15 19:55:51 +02:00
Alexander Grothe
252d6b65d1 Add ansible_managed hint to new templates 2019-05-15 19:54:41 +02:00
Alexander Grothe
de699b12b1 Add udiskie to yavdr-desktop role
this is used to mount external data devices automatically

Add yavdr-i18n to the default packages,
so translations using the transale filter will work properly
2019-05-15 16:33:36 +02:00
Alexander Grothe
6cff93c558 Fix typo
thanks to blau (vdr-portal.de)
2019-05-11 19:08:09 +02:00
Alexander Grothe
85de5f119e prevent failure if ubuntu-drivers autoinstall did not create a file 2019-05-11 19:07:04 +02:00
Alexander Grothe
3ebd5df3cb Cleanup 2019-05-09 11:40:51 +02:00
Alexander Grothe
a3331d82e4 Add and use own rmmod module instead of rmmod command.
This is a workaround for the modprobe module which fails to unload
modules using modprobe -r MODULE.

Using a dedicated module instead of a plain (shell) command allows to
fail only on important errors.
2019-05-09 11:14:15 +02:00
Alexander Grothe
9b16bd9971 Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2019-05-06 18:35:18 +02:00
Alexander Grothe
36050df5e0 Update README.md 2019-05-06 18:33:19 +02:00
Alexander Grothe
7459c79595 Cleanup unneeded variable first_run 2019-05-06 18:27:12 +02:00
Alexander Grothe
ce24cedf53 Replace nouveau driver with nvidia driver on first run
According to https://nouveau.freedesktop.org/wiki/KernelModeSetting/
it ist possible to unload the noveau and kms drivers an replace them
with the nvidia driver.

Warning: This causes the console output to freeze until
the next reboot (which shouldn't matter much because we want to output
via Xorg).

The yavdr-xorg role performs the equivalent of those command if
the module nouveau is loaded:

echo 0 > /sys/class/vtconsole/vtcon1/bind
rmmod nouveau
rmmod ttm
rmmod drm_kms_helper
rmmod drm
modprobe nvidia
systemctl start nvidia-persistenced

TODO: is the variable first_run still needed?
2019-05-06 18:23:27 +02:00
seahawk1986
f33eae5cd2
Update displays.yml 2019-04-30 18:09:29 +02:00
Alexander Grothe
9acae05e63 Rearrange order of entries 2019-04-21 13:41:40 +02:00
Alexander Grothe
f16e0cdb70 Include check for hyper-v vms 2019-04-21 13:37:53 +02:00
Alexander Grothe
10c1c662c4 Add section on how to re-run display scan to README.md 2019-04-10 10:06:08 +02:00
Alexander Grothe
e2326c5083 Don't install intel drivers and libs if a nvidia card has been detected 2019-04-08 22:36:38 +02:00
Alexander Grothe
9a35ed4a67 Don't create 20-intel.conf if nvidia_detected 2019-04-08 22:20:34 +02:00
Alexander Grothe
f4788484a9 Don't set vaapi Option for softhddevice if a nvidia card has been detected 2019-04-08 22:01:42 +02:00
Alexander Grothe
9d61e71246 Update Manual.org
TODO: make keymacros.conf created by a template
2019-04-08 22:00:34 +02:00
Alexander Grothe
186319044a Add more configuration variables and explanations to group_vars 2019-04-08 21:59:16 +02:00
Alexander Grothe
20812dc872 Add error handling for incomplete Timing information on Modelines 2019-04-07 17:43:14 +02:00
Alexander Grothe
5bb14e04e6 whitespace cleanup 2019-03-26 18:02:29 +01:00
Alexander Grothe
4973ca953f Update Manual.html 2019-03-26 14:27:22 +01:00
Alexander Grothe
8f22f9bf80 Preconfigure allowed_hosts.conf style files for plugins
set the variable vdr_allowed_hosts (must be a list of IPs/IP ranges) to preconfigure all host-
or ip-range based access options.

At the moment this applies to:
 - svdrphosts.conf
 - xineliboutput's allowed_hosts.conf (and the plugin's ARGSDIR configuration file)
 - vnsiserver's allowed_hosts.conf
 - streamdev-server's streamdevhosts.conf

It is possible to override host settings for individual services by
setting up extra lists for the following variables:
 - vdr_svdrphosts
 - xineliboutput_allowed_hosts
 - vnsiserver_allowed_hosts
 - streamdev_server_allowed_hosts
2019-03-26 14:07:17 +01:00
Alexander Grothe
d306eb118e Update Manual.html 2019-03-26 10:34:31 +01:00
Alexander Grothe
251a9b978d Improve guest addon installation for VirtualBox Guests 2019-03-26 09:17:59 +01:00
Alexander Grothe
c88f919380 remove double listed package 2019-03-25 21:13:23 +01:00
Alexander Grothe
1542c64c5a Add template for /etc/default/vdr 2019-03-25 19:39:49 +01:00
Alexander Grothe
202fb89165 Adds information on waiting for dvb adapters before starting vdr 2019-03-25 19:35:20 +01:00
Alexander Grothe
f9a61eece0 Fix path for svdrphosts.conf template expansion 2019-03-24 12:31:04 +01:00
Alexander Grothe
62473292fc Add template for svdrphosts.conf
you can define additional hosts or subnets (default is to allow access
from localhost) in svdrphosts.conf by
creating a list variable vdr_svdrphosts - e.g. in host_vars/localhost
or in group_vars/all:

vdr_svdrphosts:
   - 192.168.0.0/24

also cleanup some of the structure in Manual.org and update Manual.html
2019-03-24 12:11:52 +01:00
Alexander Grothe
8dbbfcc0c7 Add task to download channels.conf for vdr'
You can set vdr_channels_conf_url to a http(s) or ftp URL - this file
will be copied to /var/lib/vdr/channels.conf if vdr_channels_conf is
not defined and the channels.conf does not exist yet.

Also fixes a typo in task names
2019-03-18 17:12:18 +01:00
Alexander Grothe
811686490f Add task to copy a channels.conf if it doesn't exist yet
to use this task assing a path pointing to the wanted channels.conf to
the vdr_channels_conf variable, e.g. in host_vars/localhost.yml:

vdr_channels_conf: /path/to/own_config/channels.conf
2019-03-18 16:13:03 +01:00
Alexander Grothe
d86e5f2159 Update Manual.html 2019-03-12 09:38:31 +01:00
Alexander Grothe
be33234084 Add some explanations to epgd role 2019-03-12 09:36:42 +01:00
Alexander Grothe
01d95ae89b Set encoding for epgd database to utf8 2019-03-11 18:50:22 +01:00
Alexander Grothe
c706146eac Update Manual.org and Manual.html 2019-03-10 20:41:01 +01:00
Alexander Grothe
c0ad4c9c49 remove dpkg-reconfigure command from install script 2019-03-10 20:41:01 +01:00
Alexander Grothe
71e772cdca Add role for epgd
This is an initial draft. Many thanks to
minixjr (https://www.vdr-portal.de/forum/index.php?thread/131575-yavdr-ansible/&postID=1313526#post1313526).

TODOs:
 - seperate role(s) for vdr-plugin-epg2vdr and scraper2vdr
 - configure epg2vdr and scraper2vdr
 - allow to use a seperate MySQL/MariaDB server instead of a local one
2019-03-10 20:40:01 +01:00
Alexander Grothe
fa25896096 Run dpkg-reconfigure for libdvd-pkg package using a library module 2019-03-09 17:44:35 +01:00
Alexander Grothe
877e651917 Add library module for dpkg-reconfigure 2019-03-09 16:04:30 +01:00
Alexander Grothe
76ace23b5e Improve Compatibility with Python3
replace .iteritems() with .items | list in jinja2 Templates
2019-02-24 18:42:46 +01:00
Alexander Grothe
b816a03d69 Fix syntax error in state value 2019-02-22 15:45:00 +01:00
Alexander Grothe
71c2079f53 Fix video output driver for softhddevice when an intel igp is used.
it's va-api instead of va-pi - thanks to beinhart (vdr-portal.de) for noticing.
2019-02-22 13:36:09 +01:00
Alexander Grothe
08ed05594e Allow Dual Screen Configurations for intel IGPs
improve xrandr_facts.py to match drm and xrandr outputs

TODO: use drm.edid_firmware kernel boot parameter to load EDID files
  on startup
2019-02-22 00:12:02 +01:00
Alexander Grothe
c0dc185952 Adapt set-kodi-display to KODI 18 final 2019-02-04 22:18:48 +01:00
Alexander Grothe
65e2ac1e5f Disable screen blanking by default via xorg configuration snippet
Further changes:
- add ppa:yavdr/experimental-kodi for KODI 18
- add set-kodi-display script to allow switching DISPLAY in dual
screen configuration (inkompatible with KODI 17)
2019-02-04 17:57:34 +01:00
Alexander Grothe
4a2f644bb3 Update Template for sundtek.service
Always restart on failure.
2019-01-21 22:33:05 +01:00
Alexander Grothe
4bdabc7992 Update Manual.html 2019-01-19 12:27:41 +01:00
Alexander Grothe
c2962eed4c Add vdrpbd and vdr-addon-lifeguard-ng as default packages
and update rules for dvb ff devices
2019-01-19 12:23:39 +01:00
Alexander Grothe
579f3e0cd3 Remove intel snippet before running xorg-verbose 2019-01-07 22:04:41 +01:00
Alexander Grothe
9180f8d74e Fix quoting and indentation in 20-intel.conf.j2 2019-01-07 21:56:48 +01:00
Alexander Grothe
d4cbb054bd add drm to variables from facts if undefined 2019-01-07 21:44:04 +01:00
Alexander Grothe
8b885221ae Add xorg.conf.d snippet for intel graphics
TODO: load edid early within initramfs
2019-01-07 21:38:30 +01:00
Alexander Grothe
a4dcadabcf Add edid modelines to xrandr facts 2019-01-07 21:32:08 +01:00
Alexander Grothe
58859dd8d7 Add support for drm subsystem to xrandr_facts.py 2019-01-07 10:33:27 +01:00
Alexander Grothe
387daa0134 Reorganize menuorg template 2019-01-07 09:25:47 +01:00
Alexander Grothe
6f91f95d49 Add proper ansible_managed comment to file 2019-01-07 09:25:08 +01:00
Alexander Grothe
128e1683c1 Add template for menuorg.xml (to test translation filter) 2019-01-05 11:43:59 +01:00
Alexander Grothe
964d41a41a Fix typo and improve comment 2019-01-05 11:42:26 +01:00
Alexander Grothe
f5d5d78a57 Add role for vdr-plugin-menuorg 2019-01-05 11:42:07 +01:00
Alexander Grothe
a29189252e Adds an initial version of a template for intel xorg configuration
and marks the xorg-verbose.conf.j2 template with an ansible_managed comment
2019-01-04 14:26:46 +01:00
Alexander Grothe
711afd35d0 Add some hotkeys for yavdr-frontend actions to rc.xml.j2 template 2019-01-04 14:19:00 +01:00
Alexander Grothe
2559779de3 Several small fixes in various files
- xrandr_facts.py: allow detecting Virtual[1..n] devices in VirtualBox 6.0
2019-01-04 14:17:13 +01:00
Alexander Grothe
89c7254d43 Further cleanup or rc_maps.cfg.j2 2019-01-02 21:27:55 +01:00
Alexander Grothe
6522156b07 Reorganize rc_map.cfg.j2 template
ir-keytable uses the first match for a driver keytable combination (thanks to gotscha
https://www.vdr-portal.de/forum/index.php?thread/131575-yavdr-ansible/&postID=1310666#post1310666
for pointing this out).
2019-01-02 21:17:21 +01:00
Alexander Grothe
1622bbd6e6 Run ir-keytable only if installed 2019-01-02 17:22:33 +01:00
Alexander Grothe
7dd080e9e7 Add hook to reload rc-core keytables on resume 2019-01-02 17:16:11 +01:00
Alexander Grothe
f253d7c864 Add comments to templates for serial-ir 2019-01-02 12:08:37 +01:00
Alexander Grothe
b3195507fa Update README.md 2019-01-02 10:35:55 +01:00
Alexander Grothe
81aeade96c Fix paths for templates 2019-01-02 10:22:52 +01:00
Alexander Grothe
b45785bb6d Fix typos in playbook files 2019-01-02 10:13:18 +01:00
Alexander Grothe
f1709c8494 rename variable serial_device to serial_ir_device
and add an entry for the serial-ir role to the playbook (commented out
by default, so the user has to enable it if required)
2019-01-02 09:26:56 +01:00
Alexander Grothe
326c7d3119 Add role for serial ir receivers
TODO: test role for serial_device=ttyS0 and serial_device=ttyS1
2019-01-01 23:48:31 +01:00
Alexander Grothe
21710fc62b Add install script for headless installation 2018-12-31 19:42:02 +01:00
Alexander Grothe
b4afe5129f Update Manual.html 2018-12-11 14:01:50 +01:00
Alexander Grothe
142487622e Use yavdr-media package for background images 2018-12-11 14:01:04 +01:00
Alexander Grothe
591579a492 Update URLs for HTML/css theme readtheorg 2018-11-29 22:43:13 +01:00
Alexander Grothe
f2b75bb5f7 Update comment block 2018-10-27 15:04:34 +02:00
Alexander Grothe
ab2cf081b4 Fix typo 2018-10-27 14:58:22 +02:00
Alexander Grothe
82ecb114b1 Add task and templates for rudimentary standby support 2018-10-27 14:46:53 +02:00
Alexander Grothe
01e91cc529 re-add tags to kodi role import_tasks elements 2018-10-05 18:53:07 +02:00
Alexander Grothe
9ac3f32c32 Simplify installation of KODI packages 2018-10-05 18:01:28 +02:00
Alexander Grothe
fb9ea5a363 Simplify libdvd-pkg installation 2018-10-05 17:59:22 +02:00
Alexander Grothe
6f2b486608 Remove unused with_items entry 2018-10-05 17:53:07 +02:00
Alexander Grothe
96b029fd24 Update usage of apt module, move away from deprecated loop approach 2018-10-05 17:49:39 +02:00
Alexander Grothe
febd80390f Rearrange HTML_HEAD URLs 2018-10-05 17:22:16 +02:00
Alexander Grothe
03b70283ae Remove inline tags option (preparation for ansible 2.7) 2018-10-05 17:21:20 +02:00
Alexander Grothe
c4ddbb135a Deduplicate xrandr_facts.py 2018-10-01 11:12:24 +02:00
Alexander Grothe
1fbd634d43 Add example script to switch primary and secondary display applications
also don't run detect-second-display multiple times during a session.
2018-09-30 10:57:26 +02:00
Alexander Grothe
ae5d68ed79 Don't overwrite .lircrc in vdr's home directory if it already exists 2018-09-30 10:38:20 +02:00
Alexander Grothe
553ff47248 Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-09-30 10:23:05 +02:00
Alexander Grothe
2d966364e5 Improve switching primary and secondary display 2018-09-30 10:17:20 +02:00
Alexander Grothe
cd10eb1970 Add a short description for yavdr-remote role 2018-09-29 16:38:00 +02:00
Alexander Grothe
f1c422d151 Update Manual.html 2018-09-24 23:01:53 +02:00
Alexander Grothe
8fbc3f08a5 Fix detect-second-display.service 2018-09-24 22:56:36 +02:00
Alexander Grothe
244d5b63c1 Update Manual.html 2018-09-20 09:01:30 +02:00
Alexander Grothe
4286ede906 Add unique IDs to each section (so html ankers should be static) 2018-09-20 09:00:22 +02:00
Alexander Grothe
cbce3852d9 Add own section for sundtek template 2018-09-20 08:56:38 +02:00
Alexander Grothe
a4a1440177 Add section for sundtek.conf 2018-09-20 08:55:00 +02:00
Alexander Grothe
47061871ed Update Manual.html 2018-09-11 14:51:26 +02:00
Alexander Grothe
dab64fe2e3 Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-09-11 14:49:32 +02:00
Alexander Grothe
619a46649e Add openbox rule for softhdcuvid window 2018-09-11 14:31:46 +02:00
Alexander Grothe
f6f5dc59ca Add PPA for Ansible 2.6
so ansible_virtualization_type and ansible_virtualization_role are
always defined. This ist important on older Hardware (e.g. AMD64 3000+).
2018-09-05 12:23:30 +02:00
Alexander Grothe
4c78cdf79a Update Manual.html 2018-09-04 13:22:41 +02:00
Alexander Grothe
d851a4a9aa Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-09-04 13:22:16 +02:00
Alexander Grothe
260653229b Rearrange Installation of xineliboutput when a VM is detected 2018-09-04 13:21:32 +02:00
seahawk1986
804f9f172f
create empty result if no data have been found 2018-09-03 11:11:48 +02:00
Alexander Grothe
468de0a2f3 Disable warning when running shell command 2018-08-25 15:57:15 +02:00
Alexander Grothe
171bdd2eff Add SIGKILL to "normal" exit codes 2018-08-10 16:03:57 +02:00
Alexander Grothe
3a349fd6ed Prevent increasing failed status count when package is not available 2018-08-10 14:40:22 +02:00
Alexander Grothe
73a7e75db9 improve installation of kodi-send
install kodi-eventclients-xmbc-send if available, else install kodi-eventclients-kodi-send
2018-08-10 11:53:28 +02:00
Alexander Grothe
4c6c77ccc5 Add python-jmespath
for the json_filter functionality provied by ansible
2018-08-10 10:52:10 +02:00
Alexander Grothe
8a91c4f7cd only show output when ansible is called with -v 2018-08-10 09:09:34 +02:00
Alexander Grothe
057411cec8 Collect detailed pci device information in variable pci_devices 2018-08-10 09:06:15 +02:00
Alexander Grothe
48710c22c6 Add pci_facts.py module for detailed PCI device descriptions 2018-08-10 09:01:53 +02:00
Alexander Grothe
5035437aa2 Fix shebang 2018-08-10 09:00:04 +02:00
Alexander Grothe
9d9ac03f5d Update Manual.org and Manual.html 2018-08-10 08:13:55 +02:00
Alexander Grothe
e4eebf2e2d Add handler to update initramfs 2018-08-10 08:13:44 +02:00
Alexander Grothe
88d16009c7 Fix some spelling errors 2018-08-10 08:13:21 +02:00
Alexander Grothe
840423bacf Add handler to indicate a reboot is required 2018-08-10 08:12:49 +02:00
Alexander Grothe
fa2e50128d Add role to install firmware files 2018-08-10 08:12:24 +02:00
Alexander Grothe
da6cac8e24 Add rules to install drivers to yavdr07-headless.yml 2018-08-10 08:11:45 +02:00
Alexander Grothe
264f1b311c Revert "use debconf module instead of shell command"
openbox autostart calls the autostart script with sh as shell and
using ansible's debconf module does not change dash to bash
successfully, so for the moment we need to use the shell command instead.

This reverts commit 4170935a5a.
2018-08-09 10:07:20 +02:00
Alexander Grothe
43ced38313 Special configuration for openbox on second display
do not focus new windows
2018-08-05 13:57:19 +02:00
Alexander Grothe
16b84b080d Add notification 2018-08-03 12:29:20 +02:00
Alexander Grothe
6460697d33 add notification 2018-08-03 12:28:56 +02:00
Alexander Grothe
9ec3fb07ec Don't update cache when adding ppas, this is done in the next step 2018-08-03 12:07:33 +02:00
Alexander Grothe
16886c3806 Remove old code 2018-08-03 10:35:28 +02:00
Alexander Grothe
b8bd4b405e Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-08-03 10:32:16 +02:00
Alexander Grothe
4170935a5a use debconf module instead of shell command 2018-08-03 10:32:02 +02:00
Alexander Grothe
8694b2b05c Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic
and reflect change in Manual.org
2018-08-02 10:06:15 +02:00
Alexander Grothe
46de4a1b80 Don't install vdr-plugin-restfulapi by default
It crashes if the channel list is empty
2018-08-02 10:03:35 +02:00
seahawk1986
281e73cab4
mark template as managed by ansible 2018-07-23 13:43:59 +02:00
seahawk1986
0e00ea7469
Update README.md 2018-07-13 09:53:39 +02:00
Alexander Grothe
05ca162830 Add a description, TODO-list and improve initramfs-hook 2018-06-08 19:54:17 +02:00
Alexander Grothe
3138c16a60 Initial changes to support intel gpu autoconfiguration
still a lot to do...
2018-06-06 07:51:07 +02:00
Alexander Grothe
4cbb78ca34 Update Manual.html 2018-06-02 20:04:57 +02:00
Alexander Grothe
b00876f0fd Disable Composite and Force(Full)CompositionPipeline by default
Even a GTX 1030 has a choppy image on fast movements (e.g. football)
2018-06-02 20:03:24 +02:00
Alexander Grothe
b1389ae487 Create drop-in for sudo for vdr user
this allows to restart vdr.service and reboot the system
2018-05-23 09:55:57 +02:00
Alexander Grothe
96b19af073 Update Manual.html 2018-05-20 09:14:13 +02:00
Alexander Grothe
2ac7044459 Set nvidia-experimental driver to nvidia-396 2018-05-20 09:13:23 +02:00
Alexander Grothe
de6ea4615b Disable dpms for second display 2018-05-18 10:34:16 +02:00
Alexander Grothe
ddfd3cc441 Use english section title 2018-05-12 22:10:41 +02:00
Alexander Grothe
3f989fcffb Do not enable eventlircd.socket in autoinstall-yausbir
eventlircd.socket is enabled and started by yavdr-remote.
2018-05-12 21:22:22 +02:00
Alexander Grothe
7b83faf750 Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-05-12 21:21:27 +02:00
Alexander Grothe
d87fcd98f4 Do not enable eventlircd.socket
eventlircd.socket should already have been enabled by yavdr-remote
2018-05-12 21:16:41 +02:00
Alexander Grothe
65dc2b4fd7 Allow overriding preferred refresh rate, resolution and connection
for xrandr_facts module. You can set own preferences e.g. in a
host_vars/localhost.yml using the variables preferred_refreshrates,
preferred_resolutions and preferred_outputs (see
roles/yavdr-xorg/default/main.yml for default values).
2018-05-10 22:04:45 +02:00
Alexander Grothe
d68cbc252a Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-05-10 20:42:53 +02:00
Alexander Grothe
70945dc97b Add error handling for parse-edid call.
If parse-edid can not parse the given edid, use "Unknown" for vendor
and model name.
2018-05-08 10:28:25 +02:00
Alexander Grothe
6724ddcc23 Install lircd2uinput after eventlircd 2018-05-06 19:26:04 +02:00
Alexander Grothe
524f43d494 Install eventlircd after lircd has been stopped 2018-05-06 16:32:39 +02:00
Alexander Grothe
d73bc61d69 Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-05-01 07:18:20 +02:00
Alexander Grothe
96d2cc9a08 Use yavdr-xorg to control xlogin@vdr.service and x@vt7.service 2018-04-24 09:56:29 +02:00
Alexander Grothe
a330dd00a2 Update Manual.html 2018-04-24 09:35:31 +02:00
Alexander Grothe
183bd4bc30 Load environment variables from /etc/default/locale 2018-04-24 09:34:44 +02:00
Alexander Grothe
e5e15fa527 Don't install vainfo 2018-04-20 15:54:08 +02:00
Alexander Grothe
47c6a06ef2 use i965-va-driver-shaders instead of free driver to enable HEVC support 2018-04-20 15:36:26 +02:00
Alexander Grothe
85d9d624e6 Update 2018-04-20 15:26:52 +02:00
Alexander Grothe
f779fba01c Make hardware_facts.py work with different levels of PCI device trees 2018-04-20 11:47:18 +02:00
Alexander Grothe
37df4f25bb Install i965-va-driver and i965-va-driver-shaders if Intel IGP is detected 2018-04-20 11:10:11 +02:00
Alexander Grothe
85fe14ffd2 Fix glob command to collect pci device information 2018-04-20 11:06:45 +02:00
Alexander Grothe
4f857589d9 Install *-hwe virtualbox packages by default 2018-04-19 12:06:43 +02:00
Alexander Grothe
a55eccce33 Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-04-19 12:00:58 +02:00
Alexander Grothe
c43bcc30bb Do not run ubuntu-drivers autoinstall if system is a VirtualBox Client 2018-04-19 11:55:03 +02:00
Alexander Grothe
c6df27ca0c Do not add yavdr ppa, ansible in bionic repositories has been updated. 2018-04-19 10:30:43 +02:00
Alexander Grothe
2dc40f1595 Add cache timeout to apt operation 2018-04-06 09:06:03 +02:00
Alexander Grothe
4bfe28d0a9 Add header to remote.xml
without it KODI 18 won't start
2018-04-06 08:40:44 +02:00
Alexander Grothe
71a48021eb Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-04-06 08:39:43 +02:00
Alexander Grothe
f33d0e1e64 Fix Lircmap.xml header
without a proper header KODI 18 won't start
2018-04-06 08:38:07 +02:00
Alexander Grothe
b310e3341c Remove unnecessary PassEnvironment= Option
and add a Handler for sundtek.service
2018-03-25 13:09:54 +02:00
Alexander Grothe
d2afb2f2cc enable workaround for broken alsa driver messages 2018-02-23 16:00:41 +01:00
Alexander Grothe
3610ab3471 Install xineliboutput and vdr-sxfe if we got a virtualbox environment 2018-02-12 16:40:58 +01:00
Alexander Grothe
3e14f0a969 Set xineliboutput as output plugin for virtualbox 2018-02-12 16:37:41 +01:00
Alexander Grothe
d8f70de0b5 Add note for vdr user properties 2018-02-12 14:39:31 +01:00
Alexander Grothe
00d4b49aa7 Ensure /etc/systemd/system/vdr.service.d/ exists 2018-02-12 13:09:57 +01:00
Alexander Grothe
d0e13acdb3 Add rule to rc.xml for vaapidevice 2018-02-12 10:36:04 +01:00
Alexander Grothe
70cec795de rearrange some tasks 2018-02-12 10:27:56 +01:00
Alexander Grothe
cbfa45c4f2 Add .Xresources.j2 template 2018-02-12 09:14:14 +01:00
Alexander Grothe
5f34537b03 Fix path for .xinitrc.j2 template 2018-02-12 09:08:21 +01:00
Alexander Grothe
477bcc136b cleanup xorg-verbose.conf template 2018-02-12 09:04:56 +01:00
Alexander Grothe
218007ea77 Create own role for yavdr-desktop 2018-02-12 08:48:12 +01:00
seahawk1986
fa6f49de85
Update README.md 2018-02-11 17:16:08 +01:00
Alexander Grothe
0663b6fcb2 Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-01-28 16:46:14 +01:00
Alexander Grothe
84cb485404 Fix role name in yavdr07-headless.yml 2018-01-28 16:44:25 +01:00
Alexander Grothe
b0ddbb852d Move EDID settings to first device section 2018-01-27 21:01:04 +01:00
Alexander Grothe
d74da7560a Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-01-27 20:48:43 +01:00
Alexander Grothe
928bbb5b08 Allow custom browser command 2018-01-27 20:48:27 +01:00
Alexander Grothe
3b4f9d947d Wait for plymouth stop before starting x@.service 2018-01-27 20:45:31 +01:00
Alexander Grothe
85a0b26471 small cleanup 2018-01-24 11:12:03 +01:00
Alexander Grothe
d3ca791a75 Move rule to ignore eventlircd devices in xorg to own xorg.conf.d snippet 2018-01-24 10:53:05 +01:00
Alexander Grothe
b43181b9cc Add USB ID for other irmp variant 2018-01-21 12:20:13 +01:00
Alexander Grothe
9a53fbc1de Allow autospawning of pulseaudio
This possible because in bionic pulseaudio is a dbus activated service
within the user session.
2018-01-21 10:03:18 +01:00
Alexander Grothe
2745fa83b3 Fix permissions for expanded templates, allow custom url for osd2web.service 2018-01-21 09:33:52 +01:00
Alexander Grothe
5c385c03fa Merge branch 'bionic' of https://github.com/yavdr/yavdr-ansible into bionic 2018-01-19 07:55:30 +01:00
Alexander Grothe
4d393d924f Write data from xorg-detect as local facts for futher usage 2018-01-19 07:51:38 +01:00
Alexander Grothe
e51cfe4447 Update installation instructions 2018-01-19 07:49:52 +01:00
Alexander Grothe
43e1e10989 Update section title 2018-01-18 15:17:26 +01:00
Alexander Grothe
19bdac4219 Update playbook 2018-01-18 15:16:15 +01:00
Alexander Grothe
528d022d54 rename nvidia-387 to nvidia-experimental 2018-01-18 15:15:23 +01:00
Alexander Grothe
5e971cec4c disable lircmd.service 2018-01-18 09:35:32 +01:00
Alexander Grothe
7f2c92d7a2 Update Manual.html 2018-01-16 15:09:56 +01:00
Alexander Grothe
9c17b948af fix dictionary creation 2018-01-16 15:08:20 +01:00
Alexander Grothe
06ee0d83a8 Another syntax correction 2018-01-16 15:02:13 +01:00
Alexander Grothe
08c2154220 Fix indentation, reorder tasks 2018-01-16 15:01:27 +01:00
Alexander Grothe
b08f5d842a Fix indentation 2018-01-16 14:58:22 +01:00
Alexander Grothe
b8b86e8a1d Write local facts for results of xorg-detect 2018-01-16 14:56:51 +01:00
Alexander Grothe
252cade885 use ansible_managed instead of own variable ansible_managed_file 2018-01-16 13:07:58 +01:00
Alexander Grothe
92128ccce7 Update Manual.html 2018-01-16 12:51:24 +01:00
Alexander Grothe
51dd198799 Update Manual.org 2018-01-16 12:50:54 +01:00
Alexander Grothe
7de6a0e193 add xrandr variable 2018-01-16 12:28:18 +01:00
Alexander Grothe
3e24e74cff Write xorg variable to a file 2018-01-16 12:08:18 +01:00
Alexander Grothe
c53470f2fe Add dependency to collect-facts 2018-01-16 12:06:02 +01:00
Alexander Grothe
dacbabee0e Add role to download and install firmware files 2018-01-16 10:07:18 +01:00
Alexander Grothe
7c88fd6e6a Fix warning, use correct "creates" argument for command 2018-01-16 09:27:25 +01:00
Alexander Grothe
3eb292f7fb Fix driver name for yausbir: ya_usbir 2018-01-16 09:14:45 +01:00
Alexander Grothe
54401f74e0 Fix USB IDs, add new role to playbook yavdr07.yml 2018-01-16 09:12:11 +01:00
Alexander Grothe
c44ee8867c Add role autoinstall-yausbir 2018-01-16 09:05:08 +01:00
Alexander Grothe
1bcf91fecc Fix case of boolean variable 2018-01-07 19:00:27 +01:00
Alexander Grothe
7f8f5b8290 Change from tag to variable first_run 2018-01-07 18:45:01 +01:00
Alexander Grothe
e1b17e00aa Fix handler name 2018-01-07 17:58:33 +01:00
Alexander Grothe
b1ebc54438 Start xlogin@vdr after xorg.detect using a handler 2018-01-07 17:55:18 +01:00
122 changed files with 11532 additions and 3288 deletions

File diff suppressed because it is too large Load Diff

4255
Manual.org

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,75 @@
# 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:
On a Ubuntu Server 18.04.x (or minimal) Installation run the following commands: Set up a Ubuntu Server 18.04.x Installation and install `openssh-server`.
NOTE: it is important to use the [alternative server installer](https://www.ubuntu.com/download/alternative-downloads#alternate-ubuntu-server-installer) or the [mini.iso](https://help.ubuntu.com/community/Installation/MinimalCD), otherwise the boot splash and Xorg won't work properly.
### Download yavdr-ansible
NOTE: It is recommended to use a SSH connection to run the playbook, especially if a nvidia card is used (in order to change from the nouveau to the nvidia driver the local console output needs to be disabled temporarily).
Run the following commands to download the current version of yavdr-ansible:
``` ```
sudo apt-get install git sudo apt-get install git
git clone https://github.com/yavdr/yavdr-ansible git clone https://github.com/yavdr/yavdr-ansible
cd yavdr-ansible cd yavdr-ansible
git checkout bionic git checkout bionic
sudo ./install-yavdr.sh
``` ```
### Customizing the Playbooks and Variables
You can choose the roles run by the playbooks `yavdr07.yml` or ` yavdr07-headless.yml`.
If you want to customize the variables in [group_vars/all](group_vars/all), copy the file to `host_vars/localhost` before changing it. This way you can change the PPAs used and choose which extra vdr plugins and packages should be installed by default.
### Run the Playbook
If you want a system with Xorg output run:
```
sudo -H ./install-yavdr.sh
```
NOTE: on systems with a nvidia card unloading the noveau driver after installing the proprietary nvidia driver can fail (in this case ansible throws an error). If this happens please reboot your system to allow the nvidia driver to be loaded and run the install script again.
If you want a headless vdr server run:
```
sudo -H ./install-yavdr-headless.sh
```
## First Steps after the installation:
### Wait for local dvb adapters
The yaVDR VDR Package provides a systemd service `wait-for-dvb@.service` which allows to delay the start of vdr until all given locally connected dvb adapters have been initalized - e.g. to wait for `/dev/dvb/adapter0 .. /dev/dvb/adapter3`you can enable the required instances of this service like this:
```shell
systemctl enable wait-for-dvb@{0..3}.service
```
Please remember to adapt the enabled service instances if you change your configuration.
This should work foll all DVB adaptors for which udev events are generated. Note that devices with userspace drivers (e.g. by Sundtek) won't emit such events.
### Add a /var/lib/vdr/channels.conf
You can use the wirbelscan-Plugin, w_scan, t2scan (especially useful for DVB-T2) or ready-to-use channellists from http://channelpedia.yavdr.com/gen/
Important: vdr.service must be stopped if you want to edit VDR configuration files: `sudo stop vdr.service`
### Rescan displays
If you change the connected displays you may need to update the display configuration. This can be achived by running the `yavdr-xorg` role:
```shell
sudo -H ansible-playbook yavdr07.yml -b -i 'localhost_inventory' --connection=local --tags="yavdr-xorg"
```
### running single roles without a custom playbook
You can choose to (re-)run single roles included in a playbook by including their name in the `--tags` argument (see example above for rescanning displays with `yavdr-xorg`).

View File

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

View File

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

View File

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

View File

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

View File

@ -20,6 +20,13 @@
#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
@ -41,6 +48,15 @@
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
@ -48,8 +64,20 @@
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.

17
install-yavdr-headless.sh Executable file
View File

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

174
library/dpkg_reconfigure Normal file
View File

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

View File

@ -1,4 +1,4 @@
#!/usr/bin/env/python #!/usr/bin/env python
# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules. # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules.
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
@ -66,6 +66,7 @@ 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 *
@ -81,7 +82,7 @@ vendor_dict = {
} }
def get_pci_devices(): def get_pci_devices():
for device in glob.glob('/sys/devices/pci*/*:*:*/*:*:*/'): for device in chain(glob.glob('/sys/devices/pci*/*:*:*/'), 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)

69
library/pci_facts.py Executable file
View File

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

83
library/rmmod.py Normal file
View File

@ -0,0 +1,83 @@
#!/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,20 +3,31 @@ 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 * from ansible.module_utils.basic import AnsibleModule
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 order to successfully call xrandr. - This module needs a running x-server on a given display in
Returns the dictionary "xrandr", wich contains all screens with output states, connected displays, order to successfully call xrandr. Returns the dictionary
EDID info and their modes and a recommendation for the best fitting tv mode. "xrandr", wich contains all screens with output states,
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
@ -25,7 +36,7 @@ options:
- the DISPLAY variable to use when calling xrandr - the DISPLAY variable to use when calling xrandr
preferred_outputs: preferred_outputs:
required: False required: False
default: ["HDMI", "DP", "DVI", "VGA", "TV"] default: ["HDMI", "DP", "eDP", "DVI", "VGA", "TV", "Virtual"]
description: description:
- ranking of the preferred display connectors - ranking of the preferred display connectors
preferred_refreshrates: preferred_refreshrates:
@ -43,6 +54,7 @@ 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"
@ -54,12 +66,15 @@ 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", "DVI", "VGA", "TV"], type='list', required=False), default=["HDMI", "DP", "eDP", "DVI", "VGA", "TV", "Virtual"], 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(
@ -69,19 +84,21 @@ ARG_SPECS = {
'write_edids': dict(default=True, type='bool', required=False), 'write_edids': dict(default=True, type='bool', required=False),
} }
SCREEN_REGEX = re.compile("^(?P<screen>Screen\s\d+:)(?:.*)") SCREEN_REGEX = re.compile(r"^(?P<screen>Screen\s\d+:)(?:.*)")
CONNECTOR_REGEX = re.compile( CONNECTOR_REGEX = re.compile(
"^(?P<connector>.*-\d+)\s(?P<connection_state>connected|disconnected)\s(?P<primary>primary)?") r"^(?P<connector>.*-?\d+)\s(?P<connection_state>connected|disconnected)\s(?P<primary>primary)?")
MODE_REGEX = re.compile("^\s+(?P<resolution>\d{3,}x\d{3,}).*") MODE_REGEX = re.compile(r"^\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)
@ -93,10 +110,12 @@ 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
@ -118,6 +137,7 @@ 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 = {}
@ -146,7 +166,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 not "Interlace" in line: elif is_connected and "MHz" in line and "Interlace" not in line:
match = re.match(MODE_REGEX, line) match = re.match(MODE_REGEX, line)
if match: if match:
match = match.groupdict() match = match.groupdict()
@ -171,30 +191,59 @@ 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"
data = subprocess.check_output("parse-edid < {}".format(edid), shell=True, universal_newlines=True) modelines = []
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.strip().split('"')[1] vendor = line.split('"')[1]
if "ModelName" in line: if "ModelName" in line:
model = line.strip().split('"')[1] model = line.split('"')[1]
return vendor, model if "Modeline" in line:
print(line)
_, _, line = line.split('"', 2)
if not line:
print("no timing information")
continue
try:
FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS = line.split(None, 9)
except ValueError:
print("invalid timing information")
continue
print(FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS)
refresh = round(float(FF) * 1E6 / (float(H4) * float(V4)))
interlaced = "interlaced" in FLAGS
if interlaced:
refresh /= 2
refresh = int(refresh)
modeline_name = '"{}x{}_{}{}"'.format(H1, V1, refresh, "i" if interlaced else '')
modelines.append(" ".join(("Modeline", modeline_name,
FF, H1, H2, H3, H4, V1, V2, V3, V4, FLAGS)))
return vendor, model, modelines
def collect_nvidia_data(): def collect_nvidia_data():
BusID_RE = re.compile(( BusID_RE = re.compile((
'(?P<domain>[0-9a-fA-F]+)' r'(?P<domain>[0-9a-fA-F]+)'
':' r':'
'(?P<bus>[0-9a-fA-F]+)' r'(?P<bus>[0-9a-fA-F]+)'
':' r':'
'(?P<device>[0-9a-fA-F]+)' r'(?P<device>[0-9a-fA-F]+)'
'\.' r'\.'
'(?P<function>[0-9a-fA-F]+)' r'(?P<function>[0-9a-fA-F]+)'
)) ))
try: try:
data = subprocess.check_output(["nvidia-smi", "--query-gpu=name,pci.bus_id", "--format=csv", "-i0"], data = subprocess.check_output(["nvidia-smi", "--query-gpu=name,pci.bus_id",
universal_newlines=True) "--format=csv", "-i0"], universal_newlines=True)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
pass pass
except OSError: except OSError:
@ -213,7 +262,77 @@ 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():
@ -225,14 +344,13 @@ 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): def create_entry(my_dict, name, connector, resolution, refreshrate, vendor, model, modelines):
my_dict[name] = { my_dict[name] = {
'connector': connector, 'connector': connector,
'resolution': resolution, 'resolution': resolution,
@ -241,29 +359,40 @@ 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]
vendor_0, model_0 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_0)) connector_0_edid = '/etc/X11/edid.{}.bin'.format(connector_0)
create_entry(result, 'primary', connector_0, resolution_0, refreshrate_0, vendor_0, model_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, 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]
vendor_1, model_1 = parse_edid_data('/etc/X11/edid.{}.bin'.format(connector_1)) connector_1_edid = '/etc/X11/edid.{}.bin'.format(connector_1)
create_entry(result, 'secondary', connector_1, resolution_1, refreshrate_1, vendor_1, model_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, 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'], universal_newlines=True).splitlines() d = subprocess.check_output(['xrandr', '-d', module.params['display'], '--verbose'],
universal_newlines=True).splitlines()
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
xorg_data = {} xorg_data = {}
else: else:

View File

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

View File

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

View File

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

View File

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

View File

@ -3,6 +3,8 @@
- name: apt | install vdr-plugin-dvbhddevice if connected - name: apt | install vdr-plugin-dvbhddevice if connected
apt: apt:
name: vdr-plugin-dvbhddevice name:
- 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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,33 @@
---
# 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' when: '"1209:4444" in usb or "16c0:27d9" 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 when: satip_devices | bool
notify: [ 'Restart VDR' ] notify: [ 'Restart VDR' ]

View File

@ -10,7 +10,7 @@
- name: use ubuntu-drivers to install additional drivers automatically - name: use ubuntu-drivers to install additional drivers automatically
command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall
when: (ansible_virtualization_type != "virtualbox" and ansible_virtualization_role != "guest") or when: (ansible_virtualization_type != "virtualbox" and ansible_virtualization_role != "guest")
ansible_distribution_version != "16.04"
# ubuntu-drivers-common tries to autoinstall # ubuntu-drivers-common tries to autoinstall
# conflicting packages for virtualbox in Ubuntu 16.04 :( # 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,20 +1,41 @@
--- ---
# file roles/autoinstall-virtualbox-guest/tasks/main.yml # file roles/autoinstall-virtualbox-guest/tasks/main.yml
- name: collect facts about installed packages
package_facts:
manager: "apt"
- name: install virtualbox guest additions - name: install virtualbox guest additions
block: block:
- name: install packages - name: install packages
apt: apt:
state: present state: present
name: '{{ item }}' name:
with_items:
- virtualbox-guest-dkms
- virtualbox-guest-x11
- dkms - 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 # TODO: set xineliboutput as frontend
when: when:
- ansible_virtualization_type == "virtualbox" - ansible_virtualization_type == "virtualbox"
- ansible_virtualization_role == "guest" - ansible_virtualization_role == "guest"
- ansible_distribution == "Ubuntu" - ansible_distribution == "Ubuntu"
- ansible_distribution_version == "16.04"
- name: set xineliboutput as frontend
block:
- apt:
name:
- vdr-plugin-xineliboutput
- xineliboutput-sxfe
state: present
- command: '{{ item }}'
with_items:
- vdrctl disable softhddevice
- vdrctl disable vaapidevice
- vdrctl disable xine
- vdrctl disable pvr350
- vdrctl enable xineliboutput
ignore_errors: yes
when:
- ansible_virtualization_type in ["virtualbox", "VirtualPC", "VMware"]
- ansible_virtualization_role == "guest"

View File

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

View File

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

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

@ -0,0 +1 @@

View File

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

View File

@ -8,24 +8,20 @@
- name: apt | install libdvd-pkg - name: apt | install libdvd-pkg
apt: apt:
name: '{{ item }}' name: libdvd-pkg
state: present state: present
install_recommends: no install_recommends: no
with_items:
- 'libdvd-pkg'
- name: configure package libdvd-pkg - name: reconfigure libdvd-pkg
debconf: dpkg_reconfigure:
name: 'libdvd-pkg' pkg: libdvd-pkg
question: '{{ item }}' answers: |
vtype: boolean libdvd-pkg/post-invoke_hook-install: boolean true
value: true libdvd-pkg/build: boolean 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

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

98
roles/epgd/tasks/main.yml Normal file
View File

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

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

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
<?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,3 +1,4 @@
<?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,4 +35,9 @@
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,10 +2,24 @@
- name: apt | install kodi packages - name: apt | install kodi packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- kodi - kodi
- kodi-pvr-vdr-vnsi - kodi-pvr-vdr-vnsi
- kodi-eventclients-kodi-send # for ubuntu packages, team-xbmc uses "kodi-eventclients-xbmc-send for some reason - python3-lxml
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,2 +1,10 @@
- import_tasks: install-kodi.yml tags=install,update,kodi:install - import_tasks: install-kodi.yml
- import_tasks: configure-kodi.yml tags=install,update,kodi:configure tags:
- install
- update
- kodi:install
- import_tasks: configure-kodi.yml
tags:
- install
- update
- kodi:configure

View File

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

View File

@ -0,0 +1,117 @@
#!/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,12 +2,11 @@
- name: install nfs server packages - name: install nfs server packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- nfs-kernel-server - nfs-kernel-server
- nfs-common - nfs-common
state: present
install_recommends: no
- 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.iteritems() %} {% for name, path in media_dirs.items() | list %}
{{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }}) {{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }})
{% endfor %} {% endfor %}

View File

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

View File

@ -2,13 +2,12 @@
- name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol - name: apt | install pulseaudio, pavucontrol and vdr-plugin-pulsecontrol
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- pulseaudio - pulseaudio
- pavucontrol - pavucontrol
- vdr-plugin-pulsecontrol - vdr-plugin-pulsecontrol
state: present
install_recommends: no
- 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_file | comment }} {{ ansible_managed | comment }}
#======================= Global Settings ======================= #======================= Global Settings =======================
@ -69,7 +69,8 @@
# 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 user map to guest = bad password
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
@ -77,7 +78,7 @@
follow symlinks= yes follow symlinks= yes
wide links= yes wide links= yes
{% endif %} {% endif %}
{% for name, path in media_dirs.iteritems() %} {% for name, path in media_dirs.items() | list %}
[{{ name }}] [{{ name }}]
path = {{ path }} path = {{ path }}
comment = {{ name }} on %h comment = {{ name }} on %h

View File

@ -3,11 +3,10 @@
- name: install samba server - name: install samba server
apt: apt:
name: '{{ item }}' name:
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

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

View File

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

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

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

View File

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

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

@ -0,0 +1,51 @@
<?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,13 +3,12 @@
- name: apt | install basic vdr packages - name: apt | install basic vdr packages
apt: apt:
name: '{{ item }}' name:
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
@ -48,11 +47,9 @@
# 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: '{{ item }}' name: '{{ vdr_plugins | default([]) }}'
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:
@ -69,11 +66,105 @@
mode: 0644 mode: 0644
force: no force: no
- name: "vdr configuration | copy keymacros.conf if it doesn't exist yet" - name: "vdr configuration | copy keymacros.conf"
copy: copy:
src: files/keymacros.conf src: files/keymacros.conf
dest: '{{ vdr.confdir }}/keymacros.conf' dest: '{{ vdr.etc_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

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

View File

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

@ -0,0 +1,18 @@
{{ 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,2 +1,3 @@
{{ansible_managed | comment }}
[Unit] [Unit]
After=network-online.target After=network-online.target

View File

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

View File

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

View File

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

View File

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

View File

@ -28,13 +28,10 @@
with_first_found: with_first_found:
- files: - files:
- /etc/update-manager/release-upgrades - /etc/update-manager/release-upgrades
skip: true errors: ignore
- name: apt | install basic packages - name: apt | install basic packages
apt: apt:
name: '{{ item }}' name:
state: present
install_recommends: no
with_items:
- anacron - anacron
- acl - acl
- at - at
@ -43,6 +40,7 @@
- debconf-utils - debconf-utils
- linux-firmware - linux-firmware
- psmisc - psmisc
- python-jmespath
- python-kmodpy - python-kmodpy
- python-requests - python-requests
- python-usb - python-usb
@ -53,10 +51,11 @@
- wpasupplicant - wpasupplicant
- usbutils - usbutils
- xfsprogs - xfsprogs
- name: apt | install extra packages - yavdr-i18n
apt: state: present
name: '{{ item }}' install_recommends: no
- name: apt | install extra packages
apt:
name: '{{ extra_packages }}'
state: present state: present
install_recommends: no install_recommends: no
with_items:
'{{ extra_packages }}'

View File

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

View File

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

@ -0,0 +1,11 @@
- 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_file | comment('c') }} {{ ansible_managed | 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

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

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

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

View File

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

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

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

View File

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

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

@ -28,3 +28,4 @@ fi
# start systemd units for the yavdr user session # start systemd units for the yavdr user session
systemctl --user isolate yavdr-desktop.target systemctl --user isolate yavdr-desktop.target
udiskie &

View File

@ -178,6 +178,27 @@
</dock> </dock>
<keyboard> <keyboard>
<chainQuitKey>C-g</chainQuitKey> <chainQuitKey>C-g</chainQuitKey>
<!-- Keybindings for yavdr-frontend -->
<keybind key="W-a">
<action name="Execute">
<command>frontend-dbus-send start</command>
</action>
</keybind>
<keybind key="W-s">
<action name="Execute">
<command>frontend-dbus-send stop</command>
</action>
</keybind>
<keybind key="W-x">
<action name="Execute">
<command>frontend-dbus-send switchbetween kodi vdr</command>
</action>
</keybind>
<keybind key="XF86HomePage">
<action name="Execute">
<command>frontend-dbus-send toggle</command>
</action>
</keybind>
<!-- Keybindings for desktop switching --> <!-- Keybindings for desktop switching -->
<keybind key="C-A-Left"> <keybind key="C-A-Left">
<action name="GoToDesktop"> <action name="GoToDesktop">
@ -784,6 +805,18 @@
<!--<skip_pager>yes</skip_pager>--> <!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>no</skip_taskbar> <skip_taskbar>no</skip_taskbar>
</application> </application>
<application title="softhdcuvid">
<decor>no</decor>
<maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>no</skip_taskbar>
</application>
<application title="vaapidevice">
<decor>no</decor>
<maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>no</skip_taskbar>
</application>
<application class="VDR"> <application class="VDR">
<decor>no</decor> <decor>no</decor>
<maximized>yes</maximized> <maximized>yes</maximized>

View File

@ -7,7 +7,7 @@
<screen_edge_strength>20</screen_edge_strength> <screen_edge_strength>20</screen_edge_strength>
</resistance> </resistance>
<focus> <focus>
<focusNew>yes</focusNew> <focusNew>no</focusNew>
<!-- always try to focus new windows when they appear. other rules do <!-- always try to focus new windows when they appear. other rules do
apply --> apply -->
<followMouse>no</followMouse> <followMouse>no</followMouse>
@ -54,7 +54,7 @@
S: shade (roll up/down) S: shade (roll up/down)
D: omnipresent (on all desktops). D: omnipresent (on all desktops).
--> -->
<keepBorder>yes</keepBorder> <keepBorder>no</keepBorder>
<animateIconify>yes</animateIconify> <animateIconify>yes</animateIconify>
<font place="ActiveWindow"> <font place="ActiveWindow">
<name>sans</name> <name>sans</name>
@ -321,22 +321,6 @@
<direction>down</direction> <direction>down</direction>
</action> </action>
</keybind> </keybind>
<!-- Keybindings for running applications -->
<keybind key="W-e">
<action name="Execute">
<startupnotify>
<enabled>true</enabled>
<name>Konqueror</name>
</startupnotify>
<command>kfmclient openProfile filemanagement</command>
</action>
</keybind>
<!-- Launch scrot when Print is pressed -->
<keybind key="Print">
<action name="Execute">
<command>scrot</command>
</action>
</keybind>
</keyboard> </keyboard>
<mouse> <mouse>
<dragThreshold>1</dragThreshold> <dragThreshold>1</dragThreshold>
@ -796,21 +780,39 @@
<applications> <applications>
<application title="softhddevice"> <application title="softhddevice">
<decor>no</decor> <decor>no</decor>
<maximized>true</maximized> <maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>--> <!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>yes</skip_taskbar> <skip_taskbar>no</skip_taskbar>
</application>
<application title="softhdcuvid">
<decor>no</decor>
<maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>no</skip_taskbar>
</application>
<application title="vaapidevice">
<decor>no</decor>
<maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>no</skip_taskbar>
</application>
<application class="VDR">
<decor>no</decor>
<maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>no</skip_taskbar>
</application> </application>
<application title="browser"> <application title="browser">
<decor>no</decor> <decor>no</decor>
<maximized>true</maximized> <maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>--> <!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>yes</skip_taskbar> <skip_taskbar>no</skip_taskbar>
</application> </application>
<application title="osd2Web"> <application title="osd2Web">
<decor>no</decor> <decor>no</decor>
<maximized>true</maximized> <maximized>yes</maximized>
<!--<skip_pager>yes</skip_pager>--> <!--<skip_pager>yes</skip_pager>-->
<skip_taskbar>yes</skip_taskbar> <skip_taskbar>no</skip_taskbar>
</application> </application>
</applications> </applications>
</openbox_config> </openbox_config>

View File

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

@ -6,9 +6,9 @@ Before=yavdr-frontend.service
ConditionFileNotEmpty=%h/.second_display ConditionFileNotEmpty=%h/.second_display
[Service] [Service]
PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS
EnvironmentFile=%h/.second_display EnvironmentFile=%h/.second_display
ExecStart=/usr/bin/openbox --config-file %h/.config/openbox/rc.xml ExecStart=/usr/bin/openbox --config-file %h/.config/openbox/rc2.xml
ExecStartPost=/usr/bin/xset -dpms s off -display $DISPLAY
ExecStartPost=/bin/bash %h/.fehbg ExecStartPost=/bin/bash %h/.fehbg
[Install] [Install]

View File

@ -6,8 +6,10 @@ ConditionFileNotEmpty=%h/.second_display
[Service] [Service]
EnvironmentFile=%h/.second_display EnvironmentFile=%h/.second_display
PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS Environment=url="http://localhost:4444/skins/horchiTft/index.html?theme=anthraize&onlyView=1"
ExecStart=/usr/bin/on_vdr -o -c 'kiosk-browser "http://localhost:4444/skins/horchiTft/index.html?theme=bluecd&onlyView=1"' Environment=browser="kiosk-browser"
EnvironmentFile=-%h/.config/osd2web/config
ExecStart=/usr/bin/on_vdr -o -c '${browser} "${url}"'
KillSignal=SIGINT KillSignal=SIGINT
[Install] [Install]

View File

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

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

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