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
This commit is contained in:
Alexander Grothe 2019-03-10 18:05:46 +01:00
parent fa25896096
commit 71e772cdca
8 changed files with 252 additions and 6 deletions

View File

@ -291,6 +291,7 @@ The ~yavdr07.yml~ playbook sets up a fully-featured yaVDR installation:
- autoinstall-dvbsky-firmware # download and install required firmware files for dvbsky cards
- autoinstall-firmware # download and install firmware files for dvb devices
#- serial-ir # configure a serial port for "homebrew" ir receivers (e.g. Atric V5)
#- epgd # install vdr-epg-daemon (and vdr-plugin-epg2vdr)
- kodi
- dvd # set up packages and a udev rule to allow kodi and other players
# to play and eject optical media
@ -328,6 +329,7 @@ For a headless server installation ~yavdr07-headless.yml~ is a good choice
- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected
- autoinstall-dvbsky-firmware # download and install required firmware files for dvbsky cards
- autoinstall-firmware # download and install firmware files for dvb devices
#- epgd # install vdr-epg-daemon
- wakeup
tags:
- always
@ -513,8 +515,8 @@ install nvidia-396 from ppa:graphics-drivers/ppa
- name: install nvidia-396 and other required packages
apt:
name:
-nvidia-396
-nvidia-settings
- nvidia-396
- nvidia-settings
state: present
install_recommends: no
tags:
@ -6041,14 +6043,42 @@ This file maps the keys defined in Lircmap.xml to actions within kodi.
:ID: 7e7f26cf-073d-4d1c-8f6e-cc69de259aaf
:END:
#+INCLUDE: "roles/dvd/tasks/main.yml" src yaml
** vdr-epg-daemon
This role installs the vdr-epg-daemon
*** defaults
#+include: roles/epgd/defaults/main.yml src yaml
*** tasks
#+include: roles/epgd/tasks/main.yml src yml
*** templates
#+include: roles/epgd/templates/etc_mysql_mardiadb.conf.d_99-epgd.cnf.j2 src jinja2
#+include: roles/epgd/templates/root_.ssh_mysqlpasswd.j2 src jinja2
#+include: roles/epgd/templates/etc_epgd_epgd.conf.j2 src jinja2
** install-sundtek
:PROPERTIES:
:ID: de68c6d2-92c7-47c2-9d28-bfa6be00ec3e
:END:
*** variables
:PROPERTIES:
:ID: bab04ad5-86b1-4953-a87e-bb6bfa9e5d0c
:END:
*** dependencies
#+BEGIN_SRC yaml :tangle roles/install-sundtek/meta/main.yml :padline no
---
dependencies:
- { role: collect-facts }
#+END_SRC
*** defaults
#+BEGIN_SRC yaml :tangle roles/install-sundtek/defaults/main.yml
---
# file: roles/install-sundtek/defaults/main.yml
sundtek:
install: auto
wait_for_devices: true
wait_for_network: false
#+END_SRC
*** tasks
:PROPERTIES:
:ID: f06b2ce3-e6c0-41d7-809a-12d869525a11

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

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

@ -0,0 +1,94 @@
#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 }}"
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

@ -20,6 +20,7 @@
- autoinstall-dvbsddevice # install vdr-plugin-dvbsddevice if a matching card is detected
- autoinstall-dvbsky-firmware # download and install required firmware files for dvbsky cards
- autoinstall-firmware # download and install firmware files for dvb devices
#- epgd # install vdr-epg-daemon
- wakeup
tags:
- always

View File

@ -33,6 +33,7 @@
- autoinstall-dvbsky-firmware # download and install required firmware files for dvbsky cards
- autoinstall-firmware # download and install firmware files for dvb devices
#- serial-ir # configure a serial port for "homebrew" ir receivers (e.g. Atric V5)
#- epgd # install vdr-epg-daemon (and vdr-plugin-epg2vdr)
- kodi
- dvd # set up packages and a udev rule to allow kodi and other players
# to play and eject optical media