start reorganizing main.yml in roles

This commit is contained in:
Alexander Grothe 2017-07-30 14:29:38 +02:00
parent 0f9caa6605
commit 02ccd7de10
22 changed files with 198 additions and 188 deletions

View File

@ -1392,15 +1392,12 @@ b'\xde\xad\xbe\xef'
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/main.yml :mkdirp yes :padline no
---
# file: roles/yavdr-xorg/tasks/main.yml
- include: setup-xorg.yml tags:install,update
- include: desktop-session.yml
- include: detect-xorg.yml tags=xorg:detect,install
#+END_SRC
# IDEA: use hooks or requirements instead
- name: Stop VDR
systemd:
name: vdr.service
state: stopped
enabled: yes
notify: ['Start VDR']
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/setup-xorg.yml :mkdirp yes :padline no
- name: create directory /etc/systemd/system/vdr.service.d/
file:
dest: /etc/systemd/system/vdr.service.d/
@ -1439,39 +1436,8 @@ b'\xde\xad\xbe\xef'
- tmux
- kiosk-browser
- read-edid
- python3-yavdrfrontend
#- yavdr-xorg
- name: Stop xlogin
systemd:
name: xlogin@vdr.service
state: stopped
enabled: yes
- name: Stop x
systemd:
name: x@vt7.service
state: stopped
- include: detect-xorg.yml
# TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver
# nvidia, noveau, intel, radeon
- name: create xorg.conf (for nvidia driver)
template:
src: templates/xorg.conf.j2
dest: /etc/X11/xorg.conf
backup: yes
- include: desktop-session.yml
- name: enable and start xlogin for the user vdr
systemd:
daemon_reload: yes
name: 'xlogin@{{ vdr.user }}'
enabled: yes
state: started
#+END_SRC
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/detect-xorg.yml :mkdirp yes :padline no
@ -1488,6 +1454,26 @@ b'\xde\xad\xbe\xef'
src: "templates/xorg-verbose.conf.j2"
dest: "/etc/X11/xorg-verbose.conf"
- name: Stop VDR
systemd:
name: vdr.service
state: stopped
enabled: yes
notify: ['Start VDR']
- name: Stop xlogin
systemd:
name: xlogin@vdr.service
state: stopped
enabled: yes
- name: Stop x
systemd:
name: x@vt7.service
state: stopped
- name: "start x-verbose@.service"
systemd:
name: "x-verbose@vt7.service"
@ -1516,6 +1502,24 @@ b'\xde\xad\xbe\xef'
state: stopped
enabled: false
masked: true
# IDEA: use hooks or requirements instead
# TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver
# nvidia, noveau, intel, radeon
- name: create xorg.conf (for nvidia driver)
template:
src: templates/xorg.conf.j2
dest: /etc/X11/xorg.conf
backup: yes
- name: enable and start xlogin for the user vdr
systemd:
daemon_reload: yes
name: 'xlogin@{{ vdr.user }}'
enabled: yes
state: started
#+END_SRC
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/desktop-session.yml :mkdirp yes :padline no
@ -3162,6 +3166,10 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll
*** tasks
**** Install KODI
#+BEGIN_SRC yaml :tangle roles/kodi/tasks/main.yml :mkdirp yes :padline no
- include: install-kodi.yml tags=install,update,kodi:install
- include: configure-kodi.yml tags=install,update,kodi:configure
#+END_SRC
#+BEGIN_SRC yaml :tangle roles/kodi/tasks/install-kodi.yml :mkdirp yes :padline no
---
- name: apt | install kodi packages
@ -3173,7 +3181,8 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll
- kodi
- kodi-pvr-vdr-vnsi
- kodi-eventclients-xbmc-send
#+END_SRC
#+BEGIN_SRC yaml :tangle roles/kodi/tasks/configure-kodi.yml :mkdirp yes :padline no
- name: create kodi.service for the user session
template:
src: 'templates/kodi.service.j2'
@ -3194,6 +3203,23 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll
- .kodi/userdata
- .kodi/userdata/keymaps
- name: copy Lircmap.xml if it does not exist yet
copy:
dest: '{{ vdr.home }}/.kodi/userdata/Lircmap.xml'
src: 'files/userdata/Lircmap.xml'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: "0664"
force: no
- name: copy remote.xml if it does not exist yes
copy:
dest: '{{ vdr.home }}/.kodi/userdata/keymaps/remote.xml'
src: 'files/userdata/keymaps/remote.xml'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: "0664"
force: no
# TODO: Add configuration files
#+END_SRC
*** templates

View File

@ -3,7 +3,6 @@
# this is the standard text to put in templates
ansible_managed_file: "*** YAVDR: ANSIBLE MANAGED FILE ***"
branch: unstable
ppa_owner: 'ppa:yavdr'
# a list of all package repositories to be added to the installation
@ -13,7 +12,6 @@ repositories:
- '{{ ppa_owner }}/{{branch}}-vdr'
- '{{ ppa_owner }}/{{branch}}-yavdr'
- '{{ ppa_owner }}/{{branch}}-kodi'
# properties of the user vdr and vdr-related options
vdr:
user: vdr
@ -33,7 +31,6 @@ vdr_plugins:
- vdr-plugin-markad
- vdr-plugin-restfulapi
- vdr-plugin-softhddevice-vpp
# dictionary of directories for (shared) files. Automatically exported via NFS and Samba if those roles are enabled
media_dirs:
audio: /srv/audio
@ -42,14 +39,11 @@ media_dirs:
files: /srv/files
backups: /srv/backups
recordings: '{{ vdr.recdir }}'
nfs:
insecure: false # set to true for OS X clients or if you plan to use libnfs as unprivileged user (e.g. KODI)
samba:
workgroup: YAVDR
windows_compatible: '{{ vdr.safe_dirnames }}' # set to true to disable unix extensions, enable follow symlinks and wide links
# additional packages you want to install
extra_packages:
- vim
@ -58,7 +52,6 @@ extra_packages:
- w-scan
- bpython
- bpython3
frontend: vdr
#system:
# shutdown: poweroff

View File

@ -1,4 +1,3 @@
- name: Restart Samba
systemd:
name: smbd.service

View File

@ -1,5 +1,4 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "This script must be run using sudo or as root"
exit

View File

@ -1,5 +1,4 @@
#!/usr/bin/env/python
# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules.
DOCUMENTATION = '''
---

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python2
DOCUMENTATION = '''
---
module: hardware_facts

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python2
from __future__ import print_function
import ast
import binascii

View File

@ -0,0 +1,38 @@
- name: create kodi.service for the user session
template:
src: 'templates/kodi.service.j2'
dest: '{{ vdr.home }}/.config/systemd/user/kodi.service'
mode: 0755
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- name: create kodi user directory
file:
dest: '{{ vdr.home }}/{{ item }}'
state: directory
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: "0775"
with_items:
- .kodi
- .kodi/userdata
- .kodi/userdata/keymaps
- name: copy Lircmap.xml if it does not exist yet
copy:
dest: '{{ vdr.home }}/.kodi/userdata/Lircmap.xml'
src: 'files/userdata/Lircmap.xml'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: "0664"
force: no
- name: copy remote.xml if it does not exist yes
copy:
dest: '{{ vdr.home }}/.kodi/userdata/keymaps/remote.xml'
src: 'files/userdata/keymaps/remote.xml'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: "0664"
force: no
# TODO: Add configuration files

View File

@ -0,0 +1,11 @@
---
- name: apt | install kodi packages
apt:
name: '{{ item }}'
state: present
install_recommends: no
with_items:
- kodi
- kodi-pvr-vdr-vnsi
- kodi-eventclients-xbmc-send

View File

@ -1,33 +1,2 @@
---
- name: apt | install kodi packages
apt:
name: '{{ item }}'
state: present
install_recommends: no
with_items:
- kodi
- kodi-pvr-vdr-vnsi
- kodi-eventclients-xbmc-send
- name: create kodi.service for the user session
template:
src: 'templates/kodi.service.j2'
dest: '{{ vdr.home }}/.config/systemd/user/kodi.service'
mode: 0755
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
- name: create kodi user directory
file:
dest: '{{ vdr.home }}/{{ item }}'
state: directory
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: "0775"
with_items:
- .kodi
- .kodi/userdata
- .kodi/userdata/keymaps
# TODO: Add configuration files
- include: install-kodi.yml tags=install,update,kodi:install
- include: configure-kodi.yml tags=install,update,kodi:configure

View File

@ -77,7 +77,6 @@
follow symlinks= yes
wide links= yes
{% endif %}
{% for name, path in media_dirs.iteritems() %}
[{{ name }}]
path = {{ path }}
@ -93,5 +92,4 @@
wide links = yes
{% endfor %}
include = /etc/samba/smb.conf.custom

View File

@ -1,4 +1,3 @@
foo:
- bar
- baz

View File

@ -10,7 +10,6 @@
- vdr
- vdrctl
- vdr-plugin-dbus2vdr
- name: add svdrp and svdrp-disc to /etc/services
lineinfile:
dest: /etc/services
@ -19,7 +18,6 @@
with_items:
- "svdrp 6419/tcp"
- "svdrp-disc 6419/udp"
- name: create vdr recdir
file:
state: directory
@ -49,7 +47,6 @@
vdr.hide_first_recording_level
# TODO: set recdir, user etc. in /etc/vdr/conf.d/
- name: apt | install additional vdr plugins
apt:
name: '{{ item }}'
@ -58,7 +55,6 @@
with_items:
'{{ vdr_plugins | default({}) }}'
notify: [ 'Restart VDR' ]
- name: ensure vdr is stopped
systemd:
name: vdr.service

View File

@ -1,7 +1,6 @@
---
# file: roles/yavdr-common/defaults/main.yml
branch: unstable
repositories:
- 'ppa:yavdr/main'
@ -9,16 +8,13 @@ repositories:
- 'ppa:yavdr/{{branch}}-vdr'
- 'ppa:yavdr/{{branch}}-kodi'
- 'ppa:yavdr/{{branch}}-yavdr'
drivers:
sundtek: auto
ddvb-dkms: auto
extra_packages:
- vim
- tree
- w-scan
vdr:
user: vdr
group: vdr

View File

@ -4,12 +4,10 @@
template:
src: templates/90-norecommends.j2
dest: /etc/apt/apt.conf.d/90norecommends
- name: use bash instead of dash
shell: |
echo "set dash/sh false" | debconf-communicate
dpkg-reconfigure -f noninteractive dash
- name: create vdr group
group:
gid: '{{ vdr.gid }}'
@ -25,7 +23,6 @@
shell: '/bin/bash'
state: present
append: true
- name: disable release-upgrade notifications
lineinfile:
dest: /etc/update-manager/release-upgrades
@ -33,7 +30,6 @@
state: present
regexp: '^(Prompt=).*$'
line: '\1never'
- name: add yaVDR PPAs
apt_repository:
repo: '{{ item }}'
@ -45,7 +41,6 @@
apt:
upgrade: dist
update_cache: yes
- name: apt | install basic packages
apt:
name: '{{ item }}'
@ -68,7 +63,6 @@
- wpasupplicant
- usbutils
- xfsprogs
- name: apt | install extra packages
apt:
name: '{{ item }}'
@ -76,7 +70,6 @@
install_recommends: no
with_items:
'{{ extra_packages }}'
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True
@ -95,7 +88,6 @@
- debug:
var: gpus
verbosity: 1
- name: create media directories
file:
dest: '{{ item.value }}'

View File

@ -11,6 +11,26 @@
src: "templates/xorg-verbose.conf.j2"
dest: "/etc/X11/xorg-verbose.conf"
- name: Stop VDR
systemd:
name: vdr.service
state: stopped
enabled: yes
notify: ['Start VDR']
- name: Stop xlogin
systemd:
name: xlogin@vdr.service
state: stopped
enabled: yes
- name: Stop x
systemd:
name: x@vt7.service
state: stopped
- name: "start x-verbose@.service"
systemd:
name: "x-verbose@vt7.service"
@ -39,3 +59,21 @@
state: stopped
enabled: false
masked: true
# IDEA: use hooks or requirements instead
# TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver
# nvidia, noveau, intel, radeon
- name: create xorg.conf (for nvidia driver)
template:
src: templates/xorg.conf.j2
dest: /etc/X11/xorg.conf
backup: yes
- name: enable and start xlogin for the user vdr
systemd:
daemon_reload: yes
name: 'xlogin@{{ vdr.user }}'
enabled: yes
state: started

View File

@ -1,82 +1,5 @@
---
# file: roles/yavdr-xorg/tasks/main.yml
# IDEA: use hooks or requirements instead
- name: Stop VDR
systemd:
name: vdr.service
state: stopped
enabled: yes
notify: ['Start VDR']
- name: create directory /etc/systemd/system/vdr.service.d/
file:
dest: /etc/systemd/system/vdr.service.d/
state: directory
- name: add dependency to X-server for vdr.service using a drop-in
template:
src: templates/vdr-xorg.conf
dest: /etc/systemd/system/vdr.service.d/vdr-xorg.conf
- name: load environment file for vdr.service
template:
src: templates/systemd/vdr-environ.j2
dest: /etc/systemd/system/vdr.service.d/load-environ.conf
- name: set a login shell for the user vdr
user:
name: '{{ vdr.user }}'
shell: '/bin/bash'
state: present
uid: '{{ vdr.uid }}'
groups: '{{ vdr.group }}'
append: yes
- name: install packages for xorg
apt:
name: '{{ item }}'
state: present
with_items:
- xorg
- xserver-xorg-video-all
- xserver-xorg-input-all
- xlogin
- xterm
- openbox
- tmux
- kiosk-browser
- read-edid
#- yavdr-xorg
- name: Stop xlogin
systemd:
name: xlogin@vdr.service
state: stopped
enabled: yes
- name: Stop x
systemd:
name: x@vt7.service
state: stopped
- include: detect-xorg.yml
# TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver
# nvidia, noveau, intel, radeon
- name: create xorg.conf (for nvidia driver)
template:
src: templates/xorg.conf.j2
dest: /etc/X11/xorg.conf
backup: yes
- include: setup-xorg.yml tags:install,update
- include: desktop-session.yml
- name: enable and start xlogin for the user vdr
systemd:
daemon_reload: yes
name: 'xlogin@{{ vdr.user }}'
enabled: yes
state: started
- include: detect-xorg.yml tags=xorg:detect,install

View File

@ -0,0 +1,40 @@
- name: create directory /etc/systemd/system/vdr.service.d/
file:
dest: /etc/systemd/system/vdr.service.d/
state: directory
- name: add dependency to X-server for vdr.service using a drop-in
template:
src: templates/vdr-xorg.conf
dest: /etc/systemd/system/vdr.service.d/vdr-xorg.conf
- name: load environment file for vdr.service
template:
src: templates/systemd/vdr-environ.j2
dest: /etc/systemd/system/vdr.service.d/load-environ.conf
- name: set a login shell for the user vdr
user:
name: '{{ vdr.user }}'
shell: '/bin/bash'
state: present
uid: '{{ vdr.uid }}'
groups: '{{ vdr.group }}'
append: yes
- name: install packages for xorg
apt:
name: '{{ item }}'
state: present
with_items:
- xorg
- xserver-xorg-video-all
- xserver-xorg-input-all
- xlogin
- xterm
- openbox
- tmux
- kiosk-browser
- read-edid
- python3-yavdrfrontend
#- yavdr-xorg

View File

@ -1,5 +1,4 @@
#!/bin/bash
# forward environment variables to an environment file and the systemd user session
env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env
systemctl --user import-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS

View File

@ -1,3 +1,2 @@
[Service]
EnvironmentFile=-/var/lib/vdr/.session-env

View File

@ -1,4 +1,3 @@
Section "Device"
Identifier "nvidia"
Driver "nvidia"

View File

@ -1,4 +1,3 @@
{{ ansible_managed_file | comment }}
Section "ServerLayout"