yavdr-ansible/roles/vdr/tasks/main.yml
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

171 lines
4.8 KiB
YAML

---
# file: roles/vdr/tasks/main.yml
- name: apt | install basic vdr packages
apt:
name:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
state: present
install_recommends: no
- name: add svdrp and svdrp-disc to /etc/services
lineinfile:
dest: /etc/services
state: present
line: "{{ item }}"
with_items:
- "svdrp 6419/tcp"
- "svdrp-disc 6419/udp"
- name: create vdr recdir
file:
state: directory
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0775
dest: '{{ vdr.recdir }}'
- name: set option to use hide-first-recording-level patch
blockinfile:
dest: /etc/vdr/conf.d/04-vdr-hide-first-recordinglevel.conf
create: true
state: "{{ 'present' if vdr.hide_first_recording_level else 'absent' }}"
block: |
[vdr]
--hide-first-recording-level
- name: create local dir in recdir
file:
state: directory
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: '0775'
dest: '{{ vdr.recdir }}/local'
when:
vdr.hide_first_recording_level
# TODO: set recdir, user etc. in /etc/vdr/conf.d/
- name: apt | install additional vdr plugins
apt:
name: '{{ vdr_plugins | default([]) }}'
state: present
install_recommends: no
notify: [ 'Restart VDR' ]
- name: ensure vdr is stopped
systemd:
name: vdr.service
state: stopped
notify: [ 'Start VDR' ]
- name: "vdr configuration | copy remote.conf if it doesn't exist yet"
copy:
src: files/remote.conf
dest: '{{ vdr.confdir }}/remote.conf'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0644
force: no
- name: "vdr configuration | copy keymacros.conf if it doesn't exist yet"
copy:
src: files/keymacros.conf
dest: '{{ vdr.confdir }}/keymacros.conf'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0644
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: '/etc/vdr/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