2017-02-19 13:56:47 +01:00
|
|
|
---
|
2017-02-22 15:27:48 +01:00
|
|
|
# file: roles/yavdr-xorg/tasks/main.yml
|
2017-02-19 13:56:47 +01:00
|
|
|
|
2017-06-20 15:09:15 +02:00
|
|
|
|
|
|
|
# TODO: use hooks or requirements instead
|
|
|
|
- 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
|
|
|
|
|
2017-02-22 15:27:48 +01:00
|
|
|
- name: install packages for xorg
|
2017-02-19 13:56:47 +01:00
|
|
|
apt:
|
2017-02-22 15:27:48 +01:00
|
|
|
name: '{{ item }}'
|
|
|
|
state: present
|
2017-02-19 13:56:47 +01:00
|
|
|
with_items:
|
2017-02-22 15:27:48 +01:00
|
|
|
- xorg
|
|
|
|
- xserver-xorg-video-all
|
|
|
|
- xserver-xorg-input-all
|
|
|
|
- xlogin
|
|
|
|
- xterm
|
|
|
|
- openbox
|
2017-04-10 13:24:40 +02:00
|
|
|
#- yavdr-xorg
|
|
|
|
|
|
|
|
- name: "stop x@vt7.service"
|
|
|
|
systemd:
|
|
|
|
name: "x@vt7.service"
|
|
|
|
state: stopped
|
|
|
|
|
|
|
|
- name: "expand template for x-verbose@.service"
|
|
|
|
template:
|
|
|
|
src: "templates/x-verbose@.service.j2"
|
|
|
|
dest: "/etc/systemd/system/x-verbose@.service"
|
|
|
|
|
|
|
|
- name: "start x-verbose@.service"
|
|
|
|
systemd:
|
|
|
|
name: "x-verbose@vt7.service"
|
|
|
|
state: started
|
|
|
|
enabled: false
|
|
|
|
masked: false
|
|
|
|
daemon_reload: true
|
|
|
|
|
|
|
|
- name: "wait a little bit, so X has some time to start up (needed?)"
|
|
|
|
wait_for:
|
|
|
|
timeout: 3
|
|
|
|
|
|
|
|
- name: "detect xorg configuration"
|
|
|
|
action: xrandr_facts
|
|
|
|
|
|
|
|
- name: "stop x-verbose@vt7.service"
|
|
|
|
systemd:
|
|
|
|
name: "x-verbose@vt7.service"
|
|
|
|
state: stopped
|
|
|
|
enabled: false
|
|
|
|
masked: true
|
|
|
|
|
|
|
|
### TODO: Create xorg configuration
|
2017-02-22 15:27:48 +01:00
|
|
|
|
|
|
|
- name: create folders for user session
|
2017-02-19 13:56:47 +01:00
|
|
|
file:
|
2017-02-22 15:27:48 +01:00
|
|
|
state: directory
|
|
|
|
dest: '{{ item }}'
|
|
|
|
mode: '0775'
|
|
|
|
owner: '{{ vdr.user }}'
|
|
|
|
group: '{{ vdr.group }}'
|
|
|
|
with_items:
|
|
|
|
- '{{ vdr.home }}/.config/systemd/user'
|
2017-06-20 15:09:15 +02:00
|
|
|
- '{{ vdr.home }}/.config/openbox/'
|
2017-02-19 13:56:47 +01:00
|
|
|
|
2017-02-22 15:27:48 +01:00
|
|
|
### TODO: move to yavdr-xorg package? ###
|
|
|
|
- name: create folder for customizations of vdr.service
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
dest: /etc/systemd/system/vdr.service.d
|
|
|
|
mode: '0775'
|
2017-02-19 13:56:47 +01:00
|
|
|
|
2017-06-20 15:09:15 +02:00
|
|
|
- name: create folder for systemd user configuration
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
dest: '{{ vdr.home }}/.config/systemd/user'
|
|
|
|
mode: '0775'
|
|
|
|
owner: '{{ vdr.user }}'
|
|
|
|
group: '{{ vdr.group }}'
|
|
|
|
|
|
|
|
- name: create folder for openbox configuration
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
dest: '{{ vdr.home }}/.config/openbox'
|
|
|
|
mode: '0775'
|
|
|
|
owner: '{{ vdr.user }}'
|
|
|
|
group: '{{ vdr.group }}'
|
|
|
|
|
2017-02-22 15:27:48 +01:00
|
|
|
- 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/
|
|
|
|
### END TODO ###
|
2017-02-19 13:56:47 +01:00
|
|
|
|
2017-03-01 11:59:11 +01:00
|
|
|
- name: create .xinitrc for vdr user
|
2017-02-19 13:56:47 +01:00
|
|
|
template:
|
|
|
|
src: 'templates/.xinitrc.j2'
|
2017-06-20 15:09:15 +02:00
|
|
|
dest: '{{ vdr.home }}/.xinitrc'
|
2017-02-19 13:56:47 +01:00
|
|
|
mode: 0755
|
2017-02-22 15:27:48 +01:00
|
|
|
owner: '{{ vdr.user }}'
|
|
|
|
group: '{{ vdr.group }}'
|
2017-02-19 13:56:47 +01:00
|
|
|
|
2017-03-01 11:59:11 +01:00
|
|
|
- name: populate autostart for openbox
|
2017-02-19 13:56:47 +01:00
|
|
|
template:
|
|
|
|
src: 'templates/autostart.j2'
|
2017-06-20 15:09:15 +02:00
|
|
|
dest: '{{ vdr.home }}/.config/openbox/autostart'
|
|
|
|
mode: 0755
|
|
|
|
owner: '{{ vdr.user }}'
|
|
|
|
group: '{{ vdr.group }}'
|
|
|
|
|
|
|
|
- name: expand rc.xml for openbox
|
|
|
|
template:
|
|
|
|
src: 'templates/openbox_rc.xml.j2'
|
|
|
|
dest: '{{ vdr.home }}/.config/openbox/rc.xml'
|
|
|
|
mode: 0755
|
|
|
|
owner: '{{ vdr.user }}'
|
|
|
|
group: '{{ vdr.group }}'
|
|
|
|
|
|
|
|
- name: create yavdr.target for the user session
|
|
|
|
template:
|
|
|
|
src: 'templates/yavdr-desktop.target.j2'
|
|
|
|
dest: '{{ vdr.home }}/.config/systemd/user/yavdr-desktop.target'
|
2017-02-19 13:56:47 +01:00
|
|
|
mode: 0755
|
2017-02-22 15:27:48 +01:00
|
|
|
owner: '{{ vdr.user }}'
|
|
|
|
group: '{{ vdr.group }}'
|
|
|
|
|
2017-03-13 15:27:21 +01:00
|
|
|
- name: set a login shell for the user vdr
|
2017-02-22 15:27:48 +01:00
|
|
|
user:
|
|
|
|
name: '{{ vdr.user }}'
|
|
|
|
shell: '/bin/bash'
|
|
|
|
state: present
|
|
|
|
uid: '{{ vdr.uid }}'
|
|
|
|
groups: '{{ vdr.group }}'
|
|
|
|
append: yes
|
2017-02-19 13:56:47 +01:00
|
|
|
|
2017-06-20 15:09:15 +02:00
|
|
|
# TODO: run xorg-debug and parse xrandr output
|
|
|
|
# TODO: expand template for xorg.conf (or snippets)
|
|
|
|
# with respect for the available graphics card driver
|
|
|
|
# nvidia, noveau, intel, radeon
|
|
|
|
|
2017-03-13 15:27:21 +01:00
|
|
|
- name: enable and start xlogin for the user vdr
|
2017-02-22 15:27:48 +01:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
name: 'xlogin@{{ vdr.user }}'
|
|
|
|
enabled: yes
|
|
|
|
state: started
|