yavdr-ansible/roles/vdr/tasks/main.yml
2018-02-12 13:09:57 +01:00

91 lines
2.2 KiB
YAML

---
# file: roles/vdr/tasks/main.yml
- name: apt | install basic vdr packages
apt:
name: '{{ item }}'
state: present
install_recommends: no
with_items:
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
- 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: '{{ item }}'
state: present
install_recommends: no
with_items:
'{{ vdr_plugins | default({}) }}'
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: 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