add proof of concept
This commit is contained in:
parent
041f5918af
commit
65f90a610e
4
roles/grub/defaults/main.yml
Normal file
4
roles/grub/defaults/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
system:
|
||||||
|
shutdown: reboot
|
||||||
|
grub:
|
||||||
|
timeout: 0
|
7
roles/grub/handlers/main.yml
Normal file
7
roles/grub/handlers/main.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
- name: Update GRUB
|
||||||
|
command: update-grub
|
||||||
|
failed_when: ('error' in grub_register_update.stderr)
|
||||||
|
register: grub_register_update
|
||||||
|
|
||||||
|
# TODO: Do we need to use grub-set-default?
|
||||||
|
# https://github.com/yavdr/yavdr-utils/blob/master/events/actions/update-grub
|
15
roles/grub/tasks/main.yml
Normal file
15
roles/grub/tasks/main.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
- name: custom grub configuration for timeout and reboot halt
|
||||||
|
template:
|
||||||
|
src: templates/50_custom.j2
|
||||||
|
dest: /etc/grub.d/50_custom
|
||||||
|
mode: '0775'
|
||||||
|
notify: [ 'Update GRUB' ]
|
||||||
|
|
||||||
|
- name: let the system boot quietly
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/default/grub
|
||||||
|
state: present
|
||||||
|
regexp: '^(GRUB_CMDLINE_LINUX_DEFAULT=")'
|
||||||
|
line: '\1quiet nosplash"'
|
||||||
|
backrefs: yes
|
||||||
|
notify: [ 'Update GRUB' ]
|
17
roles/grub/templates/50_custom.j2
Normal file
17
roles/grub/templates/50_custom.j2
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
exec tail -n +3 $0
|
||||||
|
|
||||||
|
# This file is configured by the ansible configuration for yaVDR
|
||||||
|
|
||||||
|
{% if system.shutdown is defined and system.shutdown == 'reboot' %}
|
||||||
|
menuentry "PowerOff" {
|
||||||
|
halt
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
if [ "${recordfail}" = 1 ]; then
|
||||||
|
set timeout={{ 3 if system.grub.timeout < 3 else system.grub.timeout }}
|
||||||
|
else
|
||||||
|
set timeout={{ system.grub.timeout if system.grub.timeout is defined else 0 }}
|
||||||
|
fi
|
||||||
|
|
12
roles/install-yavdr.sh
Normal file
12
roles/install-yavdr.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if (( $EUID != 0 )); then
|
||||||
|
echo "This script must be run using sudo or as root"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add repository for ansible
|
||||||
|
add-apt-repository -y ppa:ansible/ansible
|
||||||
|
# update packages
|
||||||
|
apt-get update
|
||||||
|
# install required packages
|
||||||
|
apt-get -y install ansible libyaml-0-2 python-crypto python-ecdsa python-httplib2 python-jinja2 python-markupsafe python-paramiko python-pkg-resources python-setuptools python-six python-yaml sshpass
|
24
roles/yavdr-common/defaults/main.yml
Normal file
24
roles/yavdr-common/defaults/main.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
repositories:
|
||||||
|
branch: unstable
|
||||||
|
sources:
|
||||||
|
- 'ppa:yavdr/main'
|
||||||
|
- 'ppa:yavdr/unstable-main'
|
||||||
|
- 'ppa:yavdr/unstable-vdr'
|
||||||
|
- 'ppa:yavdr/unstable-kodi'
|
||||||
|
- 'ppa:yavdr/unstable-yavdr'
|
||||||
|
|
||||||
|
drivers:
|
||||||
|
sundtek: auto
|
||||||
|
satip: auto
|
||||||
|
ddvb-dkms: auto
|
||||||
|
imon: auto
|
||||||
|
|
||||||
|
|
||||||
|
vdr:
|
||||||
|
user: vdr
|
||||||
|
group: vdr
|
||||||
|
uid: 666
|
||||||
|
gid: 666
|
||||||
|
recdir: /srv/vdr/video
|
||||||
|
hide_first_recording_level: true
|
||||||
|
safe_dirnames: true
|
18
roles/yavdr-common/defaults/main.yml~
Normal file
18
roles/yavdr-common/defaults/main.yml~
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
repositories:
|
||||||
|
branch: unstable
|
||||||
|
|
||||||
|
drivers:
|
||||||
|
sundtek: auto
|
||||||
|
satip: auto
|
||||||
|
ddvb-dkms: auto
|
||||||
|
imon: auto
|
||||||
|
|
||||||
|
|
||||||
|
vdr:
|
||||||
|
user: vdr
|
||||||
|
groups: vdr
|
||||||
|
uid: 666
|
||||||
|
gid: 666
|
||||||
|
recdir: /srv/vdr/video
|
||||||
|
hide_first_recording_level: true
|
||||||
|
safe_dirnames: true
|
98
roles/yavdr-common/tasks/main.yml
Normal file
98
roles/yavdr-common/tasks/main.yml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
---
|
||||||
|
# this playbook sets up a minimum yaVDR installation
|
||||||
|
#
|
||||||
|
# You can customize the following variables:
|
||||||
|
# repositories.sources: a list of package repositories to use
|
||||||
|
# vdr: a dictionary with several customization options for the vdr-configuration.
|
||||||
|
# See defaults/main.yml for a complete reference
|
||||||
|
|
||||||
|
- name: 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";
|
||||||
|
|
||||||
|
- name: add yaVDR PPAs
|
||||||
|
apt_repository:
|
||||||
|
repo: '{{ item }}'
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
with_items: '{{ repositories.sources }}'
|
||||||
|
|
||||||
|
- name: upgrade existing packages
|
||||||
|
apt:
|
||||||
|
upgrade: dist
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- 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
|
||||||
|
- vim
|
||||||
|
- w-scan
|
||||||
|
- wget
|
||||||
|
- wpasupplicant
|
||||||
|
- usbutils
|
||||||
|
- xfsprogs
|
||||||
|
#- yavdr-firmware
|
||||||
|
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- 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
|
7
roles/yavdr-common/vars/main.yml
Normal file
7
roles/yavdr-common/vars/main.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
vars:
|
||||||
|
install_avahi: true
|
||||||
|
install_epgd: true
|
||||||
|
install_mariadb: true
|
||||||
|
install_nfs: true
|
||||||
|
install_samba: true
|
||||||
|
|
8
roles/yavdr-network/defaults/main.yml
Normal file
8
roles/yavdr-network/defaults/main.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
install_avahi: true
|
||||||
|
install_epgd: true
|
||||||
|
install_mariadb: true
|
||||||
|
install_nfs_client: true
|
||||||
|
install_nfs_server: true
|
||||||
|
install_samba_client: true
|
||||||
|
install_samba_server: true
|
||||||
|
|
64
roles/yavdr-network/tasks/main.yml
Normal file
64
roles/yavdr-network/tasks/main.yml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
---
|
||||||
|
# this playbook sets up network services for a yaVDR installation
|
||||||
|
#
|
||||||
|
- name: install network packages
|
||||||
|
apt:
|
||||||
|
name: '{{ item }}'
|
||||||
|
state: present
|
||||||
|
install_recommends: no
|
||||||
|
with_items:
|
||||||
|
- avahi-daemon
|
||||||
|
- avahi-utils
|
||||||
|
- biosdevname
|
||||||
|
- ethtool
|
||||||
|
- nfs-common
|
||||||
|
- vdr-addon-avahi-linker
|
||||||
|
- wakeonlan
|
||||||
|
|
||||||
|
- name: install and configure nfs-kernel-server
|
||||||
|
apt:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
install_recommends: no
|
||||||
|
with_items:
|
||||||
|
- nfs-kernel-server
|
||||||
|
when:
|
||||||
|
- install_nfs_server
|
||||||
|
|
||||||
|
#- name: install and configure mariadb-server
|
||||||
|
# apt:
|
||||||
|
# name: "{{ item }}"
|
||||||
|
# state: present
|
||||||
|
# install_recommends: no
|
||||||
|
# with_items:
|
||||||
|
# - mariadb-server
|
||||||
|
# - mariadb-client
|
||||||
|
# - python-mysqldb
|
||||||
|
# when:
|
||||||
|
# - install_mariadb
|
||||||
|
#
|
||||||
|
#- name: create a new database with name epg2vdr
|
||||||
|
# mysql_db:
|
||||||
|
# name: epg2vdr
|
||||||
|
# state: present
|
||||||
|
# encoding: utf-8
|
||||||
|
# when:
|
||||||
|
# - install_mariadb
|
||||||
|
#
|
||||||
|
# mysql_user:
|
||||||
|
# name: epg2vdr
|
||||||
|
# password: epg
|
||||||
|
# priv: 'epg2vdr.*:ALL,GRANT'
|
||||||
|
# host_all: yes
|
||||||
|
# state: present
|
||||||
|
# when:
|
||||||
|
# - install_mariadb
|
||||||
|
#
|
||||||
|
#- name: Install and configure vdr-epg-daemon
|
||||||
|
# apt:
|
||||||
|
# name: "{{ item }}"
|
||||||
|
# state: present
|
||||||
|
# with_items:
|
||||||
|
# - vdr-epg-daemon
|
||||||
|
# when:
|
||||||
|
# - install_epgd
|
34
roles/yavdr-remote/tasks/main.yml
Normal file
34
roles/yavdr-remote/tasks/main.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
# This role is used to set up the yaVDR remote control configuration.
|
||||||
|
|
||||||
|
- name: install yavdr-remote
|
||||||
|
tag: install
|
||||||
|
apt:
|
||||||
|
name: yavdr-remote
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: install lirc
|
||||||
|
tag: install
|
||||||
|
apt:
|
||||||
|
name: lircd
|
||||||
|
state: present
|
||||||
|
when:
|
||||||
|
- install_lircd is defined and install_lircd
|
||||||
|
|
||||||
|
- name: install eventlircd
|
||||||
|
tag: install
|
||||||
|
apt:
|
||||||
|
name: eventlircd
|
||||||
|
state: present
|
||||||
|
when:
|
||||||
|
install_eventlircd is defined and install_eventlircd
|
||||||
|
|
||||||
|
# TODO: upload lircd2uinput package to PPA
|
||||||
|
#- name: install lircd2uinput
|
||||||
|
# tag: install
|
||||||
|
# apt:
|
||||||
|
# name: lircd2uinput
|
||||||
|
# state: present
|
||||||
|
# when:
|
||||||
|
# install_eventlircd is defined and install_eventlircd
|
60
roles/yavdr-xorg/tasks/main.yml
Normal file
60
roles/yavdr-xorg/tasks/main.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
# this playbook sets up a graphical user session for a yaVDR installation
|
||||||
|
|
||||||
|
- name: install xorg packages
|
||||||
|
apt:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
install_recommends: no
|
||||||
|
with_items:
|
||||||
|
- openbox
|
||||||
|
- xlogin
|
||||||
|
- xorg
|
||||||
|
- xserver-xorg-input-all
|
||||||
|
- xserver-xorg-video-all
|
||||||
|
- xterm
|
||||||
|
|
||||||
|
- name: create /etc/yavdr
|
||||||
|
file:
|
||||||
|
path: /etc/yavdr
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: check if /etc/yavdr/autoinstalled exists
|
||||||
|
stat: path=/etc/yavdr/autoinstalled
|
||||||
|
register: ubuntu_drivers_autoinstalled
|
||||||
|
|
||||||
|
- name: install drivers using ubuntu-drivers autodetection
|
||||||
|
shell: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall
|
||||||
|
when: not ubuntu_drivers_autoinstalled.stat.exists
|
||||||
|
|
||||||
|
- name: set up .xinitrc for user vdr
|
||||||
|
template:
|
||||||
|
src: 'templates/.xinitrc.j2'
|
||||||
|
dest: '/var/lib/vdr/.xinitrc'
|
||||||
|
mode: 0755
|
||||||
|
owner: vdr
|
||||||
|
group: vdr
|
||||||
|
|
||||||
|
- name: create directories for desktop session
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
owner: vdr
|
||||||
|
group: vdr
|
||||||
|
mode: 0644
|
||||||
|
path: '{{ item }}'
|
||||||
|
with_items:
|
||||||
|
- /var/lib/vdr/.config/openbox/
|
||||||
|
|
||||||
|
- name: set up autostart for openbox
|
||||||
|
template:
|
||||||
|
src: 'templates/autostart.j2'
|
||||||
|
dest: '/var/lib/vdr/.config/openbox/autostart'
|
||||||
|
mode: 0755
|
||||||
|
owner: vdr
|
||||||
|
group: vdr
|
||||||
|
|
||||||
|
- name: enable xlogin@vt7.service
|
||||||
|
service:
|
||||||
|
name: xlogin@vdr.service
|
||||||
|
enabled: yes
|
2
roles/yavdr-xorg/templates/.xinitrc.j2
Normal file
2
roles/yavdr-xorg/templates/.xinitrc.j2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
exec openbox-session
|
2
roles/yavdr-xorg/templates/autostart.j2
Normal file
2
roles/yavdr-xorg/templates/autostart.j2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env
|
||||||
|
systemctl --user import-environment
|
9
yavdr07-headless.yml
Normal file
9
yavdr07-headless.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
# this playbook set up an yaVDR 0.7 installation
|
||||||
|
- name: basic setup for PPAs, packages etc.
|
||||||
|
hosts: yavdr-full
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- yavdr-common
|
||||||
|
- yavdr-network
|
||||||
|
- grub
|
10
yavdr07.yml
Normal file
10
yavdr07.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# this playbook set up an yaVDR 0.7 installation
|
||||||
|
- name: basic setup for PPAs, packages etc.
|
||||||
|
hosts: yavdr-full
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- yavdr-common
|
||||||
|
- yavdr-network
|
||||||
|
- yavdr-xorg
|
||||||
|
- grub
|
Loading…
Reference in New Issue
Block a user