vdr.service: load environment from user session, create avahi services

This commit is contained in:
Alexander Grothe 2017-06-22 13:28:10 +02:00
parent 1ca87262df
commit ae8d54aed1
2 changed files with 33 additions and 5 deletions

View File

@ -796,6 +796,7 @@ install_avahi: true
enabled: yes enabled: yes
masked: no masked: no
#+END_SRC #+END_SRC
** nfs-server ** nfs-server
*** tasks *** tasks
#+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes :padline no #+BEGIN_SRC yaml :tangle roles/nfs-server/tasks/main.yml :mkdirp yes :padline no
@ -816,7 +817,11 @@ install_avahi: true
dest: /etc/exports dest: /etc/exports
notify: [ 'Restart NFS Kernel Server' ] 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 #+END_SRC
*** templates *** templates
**** /etc/exports **** /etc/exports
@ -827,16 +832,16 @@ install_avahi: true
{% endfor %} {% endfor %}
#+END_SRC #+END_SRC
**** avahi services **** 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
<?xml version="1.0" standalone='no'?> <?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group> <service-group>
<name replace-wildcards="yes">{{ item|capitalize }} on %h</name> ## Name <name replace-wildcards="yes">{{ item.key|capitalize }} on %h</name> ## Name
<service> <service>
<type>_nfs._tcp</type> <type>_nfs._tcp</type>
<port>2049</port> <port>2049</port>
<txt-record>path={{ item.path }}</txt-record> ## path to shared Folder <txt-record>path={{ item.value }}</txt-record> ## path to shared Folder
<txt-record>subtype={% 'vdr' if item == 'recordings' else item %}</txt-record> ## subtype <txt-record>subtype={{ 'vdr' if item.key == 'recordings' else item.key }}</txt-record> ## subtype
</service> </service>
</service-group> </service-group>
#+END_SRC #+END_SRC
@ -884,6 +889,7 @@ install_avahi: true
--- ---
- name: install pulseaudio - name: install pulseaudio
apt:
name: '{{ item }}' name: '{{ item }}'
state: present state: present
install_recommends: no install_recommends: no
@ -1309,6 +1315,16 @@ b'\xde\xad\xbe\xef'
enabled: yes enabled: yes
notify: ['Start VDR'] 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 - name: Stop xlogin
systemd: systemd:
name: xlogin@vdr.service name: xlogin@vdr.service
@ -1498,6 +1514,11 @@ Wants=x@vt7.service
# {{ ansible_managed_file }} # {{ ansible_managed_file }}
exec openbox-session exec openbox-session
#+END_SRC #+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 **** Systemd User Session
***** yavdr-desktop.target ***** yavdr-desktop.target
#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/systemd/user/yavdr-desktop.target.j2 :mkdirp yes :padline no #+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/systemd/user/yavdr-desktop.target.j2 :mkdirp yes :padline no

View File

@ -14,3 +14,10 @@
src: templates/nfs-exports.j2 src: templates/nfs-exports.j2
dest: /etc/exports dest: /etc/exports
notify: [ 'Restart NFS Kernel Server' ] 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 }}'