yavdr-ansible/Manual.org

5.9 KiB

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 Ansible.

Playbooks

To set up a fully-featured yaVDR installation you can use the yavdr07.yml Playbook:

  - name: basic setup for PPAs, packages etc.
    hosts: yavdr-full
    become: true
    roles:
         - yavdr-common
         - yavdr-network
         - yavdr-xorg
         - grub

Hosts

This playbook can either be used to run the installation on the localhost or any other PC in the network that can be accessed via ssh. Simply add the host names or IP addresses to the hosts file in the respective section:

  [yavdr-full]
  localhost connection=local

  [yavdr-headless]

  [yavdr-client]

Roles

yavdr-common

This role is used to set up a basic yaVDR installation. It creates the directories, installs the vdr and other useful packages.

Variables

Several variables can be set to customize the configuration.

Repositories

You can provide a list of package repositories which provide the necessary packages. Feel free to use own PPAs if you need special customization to the VDR and it's plugins.

  branch: unstable
  repositories:
      - 'ppa:yavdr/main'
      - 'ppa:yavdr/unstable-main'
      - 'ppa:yavdr/{{branch}}-vdr'
      - 'ppa:yavdr/{{branch}}-kodi'
      - 'ppa:yavdr/{{branch}}-yavdr'
Drivers

Using autodetection to automatically install drivers can be very useful but if you know you need a certain driver, you can simply set it's value to true. If you don't want a driver to be installed, set it's value to false.

drivers:
    sundtek: auto
    ddvb-dkms: auto
Additional Packages
  extra_packages:
      - vim
      - tree
      - w-scan
VDR

This section allows you to set the recording directory, the user and group that runs the vdr and it's home directory.

user
the vdr user name
group
the main group for the user vdr
uid
the user id for the user vdr
gid
the group id for the group vdr
home
the home directory for the user vdr
recdir
the recording directory used by VDR
hide_first_recording_level
let vdr hide the first directory level of it's recording directory so the content of multiple directories is shown merged together
safe_dirnames
replace special characters which are not compatible with Windows file systems and Samba shares
override_vdr_charset
workaround for channels with weird EPG encodings, e.g. Sky
vdr:
    user: vdr
    group: vdr
    uid: 666
    gid: 666
    home: /var/lib/vdr
    recdir: /srv/vdr/video
    hide_first_recording_level: true
    safe_dirnames: true
    override_vdr_charset: false

Tasks

yavdr-common executes the following tasks:

Disable default installation of recommended packages
- name: apt| prevent installation of recommended packages
  blockinfile:
      dest: /etc/apt/apt.conf.d/90norecommends
      create: yes
      state: present
      marker: "// *** {mark} ANSIBLE MANAGED BLOCK ***"
      block: |
          // Recommends are as of now still abused in many packages
          APT::Install-Recommends "0";
          APT::Install-Suggests "0";          
Setting up the package repositories
- name: add yaVDR PPAs
  apt_repository:
      repo: '{{ item }}'
      state: present
      update_cache: yes
  with_items: '{{ repositories }}'

- name: upgrade existing packages
  apt:
      upgrade: dist
      update_cache: yes
Installing essential packages
- name: install basic packages
  apt:
      name: '{{ item }}'
      state: present
      install_recommends: no
  with_items:
      - anacron
      - at
      - bash-completion
      - biosdevname
      - linux-firmware
      - psmisc
      - software-properties-common
      - ssh
      - ubuntu-drivers-common
      - vdr
      - vdr-plugin-dbus2vdr
      - vdrctl
      - wget
      - wpasupplicant
      - usbutils
      - xfsprogs
Set up the VDR directories
- 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: 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
Set up the directories for files in /srv
- name: create directories for media files
  file:
      state: directory
      owner: '{{ vdr.user }}'
      group: '{{ vdr.group }}'
      mode: 0775
      dest: '{{ item }}'
  with_items:
      - /srv/videos
      - /srv/music
      - /srv/picture
      - /srv/backups