From ae8d54aed133018e585e76f0448c0a1680a4fd37 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 22 Jun 2017 13:28:10 +0200 Subject: [PATCH] vdr.service: load environment from user session, create avahi services --- Manual.org | 31 ++++++++++++++++++++++++++----- roles/nfs-server/tasks/main.yml | 7 +++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Manual.org b/Manual.org index fbaf158..f6a1a96 100644 --- a/Manual.org +++ b/Manual.org @@ -796,6 +796,7 @@ install_avahi: true enabled: yes masked: no #+END_SRC + ** nfs-server *** tasks #+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes :padline no @@ -816,7 +817,11 @@ install_avahi: true dest: /etc/exports notify: [ 'Restart NFS Kernel Server' ] -- name populate /etc/avahi/services +- name: populate /etc/avahi/services + template: + src: templates/avahi/service.j2 + dest: '/etc/avahi/services/yavdr-{{ item.key }}.service' + with_dict: '{{ media_dirs }}' #+END_SRC *** templates **** /etc/exports @@ -827,16 +832,16 @@ install_avahi: true {% endfor %} #+END_SRC **** avahi services -#+BEGIN_SRC xml :tangle roles/yavdr-network/avahi/service.j2 :mkdirp yes :padline no +#+BEGIN_SRC xml :tangle roles/nfs-server/templates/avahi/service.j2 :mkdirp yes :padline no -{{ item|capitalize }} on %h ## Name +{{ item.key|capitalize }} on %h ## Name _nfs._tcp 2049 - path={{ item.path }} ## path to shared Folder - subtype={% 'vdr' if item == 'recordings' else item %} ## subtype + path={{ item.value }} ## path to shared Folder + subtype={{ 'vdr' if item.key == 'recordings' else item.key }} ## subtype #+END_SRC @@ -884,6 +889,7 @@ install_avahi: true --- - name: install pulseaudio + apt: name: '{{ item }}' state: present install_recommends: no @@ -1309,6 +1315,16 @@ b'\xde\xad\xbe\xef' 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 environment file for vdr.service + template: + src: templates/systemd/vdr-environ.j2 + dest: /etc/systemd/system/vdr.service.d/load-environ.conf + - name: Stop xlogin systemd: name: xlogin@vdr.service @@ -1498,6 +1514,11 @@ Wants=x@vt7.service # {{ ansible_managed_file }} exec openbox-session #+END_SRC +**** vdr +#+BEGIN_SRC conf :tangle roles/yavdr-xorg/templates/systemd/vdr-environ.j2 +[Service] +EnvironmentFile=-/var/lib/vdr/.session-env +#+END_SRC **** Systemd User Session ***** yavdr-desktop.target #+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/systemd/user/yavdr-desktop.target.j2 :mkdirp yes :padline no diff --git a/roles/nfs-server/tasks/main.yml b/roles/nfs-server/tasks/main.yml index fff57cf..3b93f91 100644 --- a/roles/nfs-server/tasks/main.yml +++ b/roles/nfs-server/tasks/main.yml @@ -14,3 +14,10 @@ src: templates/nfs-exports.j2 dest: /etc/exports notify: [ 'Restart NFS Kernel Server' ] + +- name: populate /etc/avahi/services + template: + src: templates/avahi/service.j2 + dest: '/etc/avahi/services/yavdr-{{ item.key }}.service' + with_dict: + - '{{ media_dirs }}'