From 14a9ea894ce8e7d211624dd92999bba80d159a3e Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Wed, 1 Mar 2017 21:11:56 +0100 Subject: [PATCH] Add svdrp service definition, improve template --- Manual.org | 139 +++++++++++------- roles/vdr/tasks/main.yml | 14 +- .../yavdr-common/templates/90-norecommends.j2 | 2 +- 3 files changed, 102 insertions(+), 53 deletions(-) diff --git a/Manual.org b/Manual.org index 6f81e76..7f4dacc 100644 --- a/Manual.org +++ b/Manual.org @@ -8,6 +8,7 @@ #+HTML_HEAD: #+HTML_HEAD: #+OPTIONS: ^:nil +#+PROPERTY: header-args :mkdirp yes :END: * Installing and configuring yaVDR with Ansible This is an experimental feature which allows to set up a yaVDR installation based on a normal Ubuntu Server 16.04.x installation using [[http://ansible.com][Ansible]]. @@ -77,12 +78,15 @@ localhost connection=local #+END_SRC * Group Variables +** default text for templates #+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes # file: group_vars/all # this is the standard text to put in templates ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***" - +#+END_SRC +** PPAs +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes branch: unstable ppa_owner: 'ppa:yavdr' # a list of all package repositories to be added to the installation @@ -92,18 +96,24 @@ repositories: - '{{ ppa_owner }}/{{branch}}-vdr' - '{{ ppa_owner }}/{{branch}}-yavdr' - '{{ ppa_owner }}/{{branch}}-kodi' - +#+END_SRC +** Drivers +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes drivers: sundtek: auto ddvb-dkms: auto - +#+END_SRC +** Media directories +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes # dictionary of directories for (shared) files. Automatically exported via NFS and Samba if those roles are enabled media_dirs: audio: /srv/audio video: /srv/audio pictures: /srv/audio files: /srv/files - +#+END_SRC +** VDR user, directories, special configuration and plugins +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes # properties of the user vdr and vdr-related options vdr: user: vdr @@ -123,15 +133,22 @@ vdr_plugins: - vdr-plugin-restfulapi - vdr-plugin-softhddevice +#+END_SRC +** Samba +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes samba: workgroup: YAVDR - +#+END_SRC +** Additional packages +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes # additional packages you want to install extra_packages: - vim - tree - w-scan - +#+END_SRC +** System pre-configuration +#+BEGIN_SRC yaml :tangle group_vars/all :mkdirp yes system: shutdown: poweroff grub: @@ -361,62 +378,82 @@ if __name__ == '__main__': #+END_SRC *** templates #+BEGIN_SRC shell :tangle roles/yavdr-common/templates/90-norecommends.j2 :mkdirp yes -// {{ ansible_managed_file }} +{{ ansible_managed_file | comment('c') }} // Recommends are as of now still abused in many packages APT::Install-Recommends "0"; APT::Install-Suggests "0"; #+END_SRC ** vdr *** tasks +**** install the basic vdr packages #+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes ---- -# file: roles/vdr/tasks/main.yml + --- + # 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: apt | install basic vdr packages + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + - vdr + - vdrctl + - vdr-plugin-dbus2vdr +#+END_SRC +**** Add svdrp/svdrp-disc to /etc/services +#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes + - name: add svdrp to /etc/services + lineinfile: + dest: /etc/services + state: present + line: "svdrp 6419/tcp" -- name: create vdr recdir - file: - state: directory - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - mode: 0775 - dest: '{{ vdr.recdir }}' + - name: add svdrp-disc to /etc/services + lineinfile: + dest: /etc/services + state: present + line: "svdrp-disc 6419/udp" +#+END_SRC +**** Set up the recording directory for the vdr user +#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes + - 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 - block: | - [vdr] - --hide-first-recording-level - when: - vdr.hide_first_recording_level + - name: set option to use hide-first-recording-level patch + blockinfile: + dest: /etc/vdr/conf.d/04-vdr-hide-first-recordinglevel.conf + create: true + block: | + [vdr] + --hide-first-recording-level + when: + 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 - -- name: install additional vdr plugins - apt: - name: '{{ item }}' - state: present - install_recommends: no - with_items: - '{{ vdr_plugins }}' + - 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 +#+END_SRC +**** Install additional vdr plugins +The additional plugins to install can be set in the variable ~{{vdr_plugins}}~ in the group variables +#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes + - name: install additional vdr plugins + apt: + name: '{{ item }}' + state: present + install_recommends: no + with_items: + '{{ vdr_plugins | default({}) }}' #+END_SRC *** Set up the directories for files in /srv #+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes diff --git a/roles/vdr/tasks/main.yml b/roles/vdr/tasks/main.yml index f43f4b6..10db409 100644 --- a/roles/vdr/tasks/main.yml +++ b/roles/vdr/tasks/main.yml @@ -11,6 +11,18 @@ - vdrctl - vdr-plugin-dbus2vdr +- name: add svdrp to /etc/services + lineinfile: + dest: /etc/services + state: present + line: "svdrp 6419/tcp" + +- name: add svdrp-disc to /etc/services + lineinfile: + dest: /etc/services + state: present + line: "svdrp-disc 6419/udp" + - name: create vdr recdir file: state: directory @@ -45,7 +57,7 @@ state: present install_recommends: no with_items: - '{{ vdr_plugins }}' + '{{ vdr_plugins | default({}) }}' - name: create directories for media files file: diff --git a/roles/yavdr-common/templates/90-norecommends.j2 b/roles/yavdr-common/templates/90-norecommends.j2 index a4b9ce7..e58919b 100644 --- a/roles/yavdr-common/templates/90-norecommends.j2 +++ b/roles/yavdr-common/templates/90-norecommends.j2 @@ -1,4 +1,4 @@ -// {{ ansible_managed_file }} +{{ ansible_managed_file | comment('c') }} // Recommends are as of now still abused in many packages APT::Install-Recommends "0"; APT::Install-Suggests "0";