From 88254f8e79ffc21d39009413068cf908b5ece824 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Mon, 1 Jan 2018 22:39:10 +0100 Subject: [PATCH] add tags to yavdr-remote, add autoinstall-atric-usb role --- Manual.org | 129 +++++++++++++++++++++++------ roles/collect-facts/tasks/main.yml | 7 ++ roles/yavdr-remote/tasks/main.yml | 47 ++++++----- 3 files changed, 138 insertions(+), 45 deletions(-) diff --git a/Manual.org b/Manual.org index 3791d36..585b06b 100644 --- a/Manual.org +++ b/Manual.org @@ -237,7 +237,7 @@ localhost connection=local # file: group_vars/all # this is the standard text to put in templates -ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***" +ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***\norigin: {file}" #+END_SRC ** PPAs #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes @@ -271,7 +271,6 @@ vdr_plugins: - vdr-plugin-markad - vdr-plugin-restfulapi - vdr-plugin-softhddevice-vpp - #+END_SRC ** Media directories #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes @@ -594,6 +593,13 @@ APT::Install-Suggests "0"; - intel_detected - amd_detected - virtualbox_detected + +- name: known vdr output plugins + vars: + vdr_output_plugins: + - softhddevice + - xineliboutput + - xine #+END_SRC ** vdr *** tasks @@ -966,25 +972,38 @@ install_avahi: true #+END_SRC ** STARTED yavdr-remote *** default variables +#+BEGIN_SRC yaml :tangle roles/yavdr-remote/defaults/main.yml :mkdirp yes :padline no +lircd0_socket: /var/run/lirc/lircd0 +#+END_SRC *** tasks #+BEGIN_SRC yaml :tangle roles/yavdr-remote/tasks/main.yml :mkdirp yes :padline no --- # This role is used to set up the yaVDR remote control configuration. -- name: apt | install yavdr-remote +- name: apt | install packages for remote support apt: - name: yavdr-remote + name: '{{ item }}' state: present + with_items: + - yavdr-remote + - lirc + - eventlircd + - lircd2uinput + tags: + - packages -- name: apt | install eventlircd - apt: - name: eventlircd - state: present - -- name: apt | install lirc - apt: - name: lirc - state: present +- name: add systemd drop-in for lircd to use lircd2uinput + block: + - name: create directory /etc/systemd/system/lircd.service.d/ + file: + path: /etc/systemd/system/lircd.service.d/ + state: directory + - name: expand template for /etc/systemd/system/lircd.service.d/lircd2uinput.conf + template: + src: templates/lircd.service.d/lircd2uinput.conf.j2 + dest: /etc/systemd/system/lircd.service.d/lircd2uinput.conf + tags: + - config - name: stop, mask and disable lircd.socket, lircd.service and lircd-uinput.service # (the default lirc configuration conflicts with eventlircd) systemd: @@ -997,27 +1016,24 @@ install_avahi: true - lircd.socket - lircd-uinput.service ignore_errors: yes + tags: + - systemd - name: configure vdr to read from a lircd-compatible socket template: src: templates/03-vdr-lirc.conf.j2 dest: /etc/vdr/conf.d/03-vdr-lirc.conf notify: ['Restart VDR'] + tags: + - config - name: expand template for /etc/rc_maps.cfg template: src: templates/rc_maps.cfg.j2 dest: /etc/rc_maps.cfg notify: ['Trigger Udev'] - -# TODO: upload lircd2uinput package to PPA -#- name: install lircd2uinput -# tag: install -# apt: -# name: lircd2uinput -# state: present -# when: -# install_eventlircd is defined and install_eventlircd + tags: + - config #+END_SRC *** templates **** Systemd Drop-in to start vdr with lirc support @@ -1027,6 +1043,12 @@ install_avahi: true --lirc=/var/run/lirc/lircd {% endif %} #+END_SRC +**** Systemd Drop-in to start lircd2uinput with lircd +#+BEGIN_SRC conf :tangle roles/yavdr-remote/templates/lircd.service.d/lircd2uinput.conf.j2 :mkdirp yes :padline no +[Service] +ExecStartPre=/usr/bin/lircd2uinput-add /var/run/lirc/lircd0 +ExecStartPre=/usr/bin/lircd2uinput-remove /var/run/lirc/lircd0 +#+END_SRC **** create /etc/rc_maps.cfg #+BEGIN_SRC conf :tangle roles/yavdr-remote/templates/rc_maps.cfg.j2 :mkdirp yes :padline no # @@ -1992,8 +2014,7 @@ KillMode=mixed ***** Drop-in snippet for vdr.service #+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/vdr-xorg.conf :mkdirp yes :padline no -# file: roles/yavdr-xorg/templates/vdr-xorg.conf -# {{ ansible_managed_file }} +{{ ansible_managed_file | comment }} [Unit] After=x@vt7.service Wants=x@vt7.service @@ -2002,7 +2023,7 @@ Wants=x@vt7.service ***** .xinitrc #+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/.xinitrc.j2 :mkdirp yes :padline no #!/bin/bash -# {{ ansible_managed_file }} +{{ ansible_managed_file | comment }} exec openbox-session #+END_SRC ***** xorg.conf @@ -3510,6 +3531,64 @@ This role installs the guest additions for virtualbox guests on Ubuntu 16.04 - ansible_distribution == "Ubuntu" - ansible_distribution_version == "16.04" #+END_SRC +** autoinstall-atric-usb +*** dependencies +#+BEGIN_SRC yaml :tange roles/autoinstall-atric-usb/meta/main.yml :padline no +--- +dependencies: + - { role: yavdr-remote } + +#+END_SRC +*** tasks +#+BEGIN_SRC yaml :tangle roles/autoinstall-atric-usb/tasks/main.yml :padline no +--- +# file roles/autoinstall-atric-usb/tasks/main.yml + +- name: install and configure Atric IR-WakeupUSB + block: + - name: apt | install lirc-drv-irman + apt: + name: lirc-drv-irman + + - name: write lirc configuration + template: + src: templates/lircd_options.conf.j2 + dest: /etc/lirc/lircd_options.conf + + - name: enable lircd + systemd: + name: lircd.service + enabled: yes + state: started + masked: no + daemon_reload: yes + + when: '"04d8:f844" in usb' +#+END_SRC +*** templates +#+BEGIN_SRC conf :tangle roles/autoinstall-atric-usb/templates/lircd_options.conf.j2 :padline no +{{ ansible_managed_file | comment }} + +[lircd] +nodaemon = False +driver = irman +device = /dev/irman +output = /var/run/lirc/lircd0 +pidfile = /var/run/lirc/lircd0.pid +plugindir = /usr/lib/x86_64-linux-gnu/lirc/plugins +permission = 666 +allow-simulate = No +repeat-max = 600 +#loglevel = 6 +#release = true +#release_suffix = _EVUP +#logfile = ... +#driver-options = ... + +[lircmd] +uinput = False +nodaemon = False +#+END_SRC ** autoinstall-satip If a Sat>IP Server responds to a discovery request, the package vdr-plugin-satip is installed. *** tasks diff --git a/roles/collect-facts/tasks/main.yml b/roles/collect-facts/tasks/main.yml index 8c8fb06..bae41c0 100644 --- a/roles/collect-facts/tasks/main.yml +++ b/roles/collect-facts/tasks/main.yml @@ -21,3 +21,10 @@ - intel_detected - amd_detected - virtualbox_detected + +- name: known vdr output plugins + vars: + vdr_output_plugins: + - softhddevice + - xineliboutput + - xine diff --git a/roles/yavdr-remote/tasks/main.yml b/roles/yavdr-remote/tasks/main.yml index 86fc4d2..49ba690 100644 --- a/roles/yavdr-remote/tasks/main.yml +++ b/roles/yavdr-remote/tasks/main.yml @@ -1,20 +1,30 @@ --- # This role is used to set up the yaVDR remote control configuration. -- name: apt | install yavdr-remote +- name: apt | install packages for remote support apt: - name: yavdr-remote + name: '{{ item }}' state: present + with_items: + - yavdr-remote + - lirc + - eventlircd + - lircd2uinput + tags: + - packages -- name: apt | install eventlircd - apt: - name: eventlircd - state: present - -- name: apt | install lirc - apt: - name: lirc - state: present +- name: add systemd drop-in for lircd to use lircd2uinput + block: + - name: create directory /etc/systemd/system/lircd.service.d/ + file: + path: /etc/systemd/system/lircd.service.d/ + state: directory + - name: expand template for /etc/systemd/system/lircd.service.d/lircd2uinput.conf + template: + src: templates/lircd.service.d/lircd2uinput.conf.j2 + dest: /etc/systemd/system/lircd.service.d/lircd2uinput.conf + tags: + - config - name: stop, mask and disable lircd.socket, lircd.service and lircd-uinput.service # (the default lirc configuration conflicts with eventlircd) systemd: @@ -27,24 +37,21 @@ - lircd.socket - lircd-uinput.service ignore_errors: yes + tags: + - systemd - name: configure vdr to read from a lircd-compatible socket template: src: templates/03-vdr-lirc.conf.j2 dest: /etc/vdr/conf.d/03-vdr-lirc.conf notify: ['Restart VDR'] + tags: + - config - name: expand template for /etc/rc_maps.cfg template: src: templates/rc_maps.cfg.j2 dest: /etc/rc_maps.cfg notify: ['Trigger Udev'] - -# TODO: upload lircd2uinput package to PPA -#- name: install lircd2uinput -# tag: install -# apt: -# name: lircd2uinput -# state: present -# when: -# install_eventlircd is defined and install_eventlircd + tags: + - config