2017-07-16 11:05:54 +02:00
|
|
|
---
|
|
|
|
# file: roles/yavdr-xorg/tasks/detect-xorg.yml
|
|
|
|
|
|
|
|
- name: "expand template for x-verbose@.service"
|
|
|
|
template:
|
|
|
|
src: "templates/systemd/system/x-verbose@.service.j2"
|
|
|
|
dest: "/etc/systemd/system/x-verbose@.service"
|
|
|
|
|
|
|
|
- name: "expand template for xorg-verbose.conf"
|
|
|
|
template:
|
|
|
|
src: "templates/xorg-verbose.conf.j2"
|
|
|
|
dest: "/etc/X11/xorg-verbose.conf"
|
|
|
|
|
2019-01-07 22:04:41 +01:00
|
|
|
- name: "remove intel snippet"
|
|
|
|
file:
|
|
|
|
path: /etc/X11/xorg.conf.d/20-intel.conf
|
|
|
|
state: absent
|
|
|
|
|
2017-07-30 14:29:38 +02:00
|
|
|
- name: Stop VDR
|
|
|
|
systemd:
|
|
|
|
name: vdr.service
|
|
|
|
state: stopped
|
|
|
|
enabled: yes
|
|
|
|
notify: ['Start VDR']
|
|
|
|
|
2018-04-24 09:56:29 +02:00
|
|
|
- name: Stop yavdr-xorg
|
|
|
|
systemd:
|
|
|
|
name: 'yavdr-xorg'
|
|
|
|
state: stopped
|
|
|
|
enabled: yes
|
|
|
|
notify: ['Start yavdr-xorg']
|
|
|
|
|
2017-07-30 14:29:38 +02:00
|
|
|
- name: Stop xlogin
|
|
|
|
systemd:
|
2017-07-30 23:28:13 +02:00
|
|
|
name: 'xlogin@{{ vdr.user }}.service'
|
2017-07-30 14:29:38 +02:00
|
|
|
state: stopped
|
2018-01-07 17:58:33 +01:00
|
|
|
notify: ['Start xlogin']
|
2017-07-30 14:29:38 +02:00
|
|
|
|
|
|
|
- name: Stop x
|
|
|
|
systemd:
|
|
|
|
name: x@vt7.service
|
|
|
|
state: stopped
|
|
|
|
|
2019-05-23 16:27:05 +02:00
|
|
|
- name: check /etc/yavdr/autoinstalled if a nvidia driver has been installed
|
|
|
|
lineinfile:
|
|
|
|
name: /etc/yavdr/autoinstalled
|
|
|
|
regexp: '.*nvidia.*'
|
|
|
|
state: absent
|
|
|
|
check_mode: yes
|
2019-05-23 16:36:42 +02:00
|
|
|
register: nvidia_driver_detected
|
2019-05-23 16:27:05 +02:00
|
|
|
|
|
|
|
- name: set_fact | nvidia_driver_installed
|
2019-05-06 15:27:01 +02:00
|
|
|
set_fact:
|
2019-05-23 16:36:42 +02:00
|
|
|
nvidia_driver_installed: '{{ nvidia_driver_detected.changed | bool }}'
|
2019-05-06 15:27:01 +02:00
|
|
|
|
|
|
|
- name: unload nouveau driver, replace with nvidia
|
2018-01-07 17:40:29 +01:00
|
|
|
block:
|
2019-05-06 15:27:01 +02:00
|
|
|
- name: unbind vconsole
|
|
|
|
shell: echo 0 > /sys/class/vtconsole/vtcon1/bind
|
|
|
|
|
|
|
|
- name: "wait a little, so noveau isn't used anymore"
|
2018-01-07 17:40:29 +01:00
|
|
|
wait_for:
|
2019-05-06 15:27:01 +02:00
|
|
|
timeout: 1
|
|
|
|
|
|
|
|
# unloading the drivers using the modprobe module does not work for some strange reason...
|
|
|
|
- name: unload kms drivers
|
2019-05-08 13:26:02 +02:00
|
|
|
rmmod:
|
|
|
|
name: '{{ item }}'
|
2019-05-06 15:27:01 +02:00
|
|
|
loop:
|
|
|
|
- nouveau
|
|
|
|
- ttm
|
|
|
|
- drm_kms_helper
|
|
|
|
- drm
|
2019-05-08 13:26:02 +02:00
|
|
|
|
2019-05-06 15:27:01 +02:00
|
|
|
- name: load nvidia driver
|
|
|
|
modprobe:
|
|
|
|
name: "nvidia"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: "wait a little before starting nvidia-persistenced"
|
2018-01-07 17:40:29 +01:00
|
|
|
wait_for:
|
2019-05-06 15:27:01 +02:00
|
|
|
timeout: 1
|
2018-01-07 12:56:46 +01:00
|
|
|
|
2019-05-06 15:27:01 +02:00
|
|
|
- name: start nvidia-persistenced
|
|
|
|
systemd:
|
|
|
|
name: "nvidia-persistenced"
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
masked: false
|
|
|
|
daemon_reload: true
|
|
|
|
when:
|
2019-05-23 17:10:19 +02:00
|
|
|
- nvidia_detected | bool
|
|
|
|
- nvidia_driver_installed | bool
|
2019-05-06 15:27:01 +02:00
|
|
|
- '"nouveau" in modules'
|
|
|
|
|
2018-01-07 12:56:46 +01:00
|
|
|
- name: "start x-verbose@.service"
|
2018-01-07 14:53:19 +01:00
|
|
|
systemd:
|
|
|
|
name: "x-verbose@vt7.service"
|
|
|
|
state: started
|
|
|
|
enabled: false
|
|
|
|
masked: false
|
|
|
|
daemon_reload: true
|
2018-01-07 12:56:46 +01:00
|
|
|
|
2019-05-06 15:27:01 +02:00
|
|
|
- name: "wait a little, so X has some time to start up"
|
2018-01-07 14:53:19 +01:00
|
|
|
wait_for:
|
|
|
|
timeout: 3
|
2018-01-07 12:56:46 +01:00
|
|
|
|
2017-07-16 11:05:54 +02:00
|
|
|
- name: "detect xorg configuration"
|
2018-05-10 22:04:45 +02:00
|
|
|
xrandr_facts:
|
|
|
|
preferred_refreshrates: '{{ preferred_refreshrates }}'
|
|
|
|
preferred_resolutions: '{{ preferred_resolutions }}'
|
|
|
|
preferred_outputs: '{{ preferred_outputs }}'
|
2017-07-16 11:05:54 +02:00
|
|
|
|
|
|
|
- debug:
|
|
|
|
var: xorg.primary
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
var: xorg.secondary
|
|
|
|
when: xorg.secondary is defined
|
|
|
|
|
2019-01-07 10:33:27 +01:00
|
|
|
- debug:
|
|
|
|
var: drm
|
|
|
|
when: drm is defined
|
|
|
|
|
2017-07-16 11:05:54 +02:00
|
|
|
- name: "stop x-verbose@vt7.service"
|
|
|
|
systemd:
|
|
|
|
name: "x-verbose@vt7.service"
|
|
|
|
state: stopped
|
|
|
|
enabled: false
|
|
|
|
masked: true
|
2017-07-30 14:29:38 +02:00
|
|
|
|
2019-05-06 15:27:01 +02:00
|
|
|
#- name: "wait a little bit, so X has some time to shut down (needed?)"
|
|
|
|
# wait_for:
|
|
|
|
# timeout: 3
|
2017-11-21 11:30:03 +01:00
|
|
|
|
2018-01-16 14:56:51 +01:00
|
|
|
- name: save results
|
|
|
|
block:
|
2018-01-16 15:01:27 +01:00
|
|
|
- name: ensure facts.d directory exists
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
path: /etc/ansible/facts.d
|
|
|
|
|
2018-01-19 07:51:38 +01:00
|
|
|
- name: write xorg variable as local fact
|
2018-01-16 15:02:13 +01:00
|
|
|
copy:
|
2018-01-19 07:51:38 +01:00
|
|
|
content: '{{ {"xorg": xorg} | to_nice_json }}'
|
2018-01-16 15:02:13 +01:00
|
|
|
dest: /etc/ansible/facts.d/xorg.fact
|
2018-01-19 07:51:38 +01:00
|
|
|
|
|
|
|
- name: write xrandr variable as local fact
|
|
|
|
copy:
|
|
|
|
content: '{{ {"xrandr": xrandr} | to_nice_json }}'
|
|
|
|
dest: /etc/ansible/facts.d/xrandr.fact
|
2019-01-07 10:33:27 +01:00
|
|
|
|
|
|
|
- name: write drm variable as local fact
|
|
|
|
copy:
|
|
|
|
content: '{{ {"drm": drm} | to_nice_json }}'
|
|
|
|
dest: /etc/ansible/facts.d/drm.fact
|
2018-01-16 14:56:51 +01:00
|
|
|
when:
|
|
|
|
- xrandr is defined
|
|
|
|
- xorg is defined
|
2019-01-07 10:33:27 +01:00
|
|
|
- drm is defined
|
2018-01-16 14:56:51 +01:00
|
|
|
|
2019-01-07 21:44:04 +01:00
|
|
|
- name: update xorg, xrandr and drm variables with values from local facts if needed
|
2018-01-16 14:56:51 +01:00
|
|
|
set_fact:
|
2019-01-04 14:17:13 +01:00
|
|
|
xorg: '{{ ansible_local.xorg.xorg }}'
|
|
|
|
xrandr: '{{ ansible_local.xrandr.xrandr }}'
|
2019-01-07 21:44:04 +01:00
|
|
|
drm: '{{ ansible_local.drm.drm }}'
|
2018-01-16 14:56:51 +01:00
|
|
|
when:
|
|
|
|
- xrandr is undefined
|
|
|
|
- xorg is undefined
|
2019-01-07 21:44:04 +01:00
|
|
|
- drm is undefined
|
2018-01-16 14:56:51 +01:00
|
|
|
|
2017-07-30 14:29:38 +02:00
|
|
|
# TODO: expand template for xorg.conf (or snippets)
|
|
|
|
# with respect for the available graphics card driver
|
|
|
|
# nvidia, noveau, intel, radeon
|
2017-11-21 11:30:03 +01:00
|
|
|
|
|
|
|
- name: nvidia related config
|
|
|
|
block:
|
|
|
|
- name: create xorg.conf (for nvidia driver)
|
|
|
|
template:
|
|
|
|
src: templates/xorg.conf.j2
|
|
|
|
dest: /etc/X11/xorg.conf
|
|
|
|
backup: yes
|
|
|
|
when:
|
2019-05-23 17:10:19 +02:00
|
|
|
- nvidia_detected | bool
|
2019-01-07 21:38:30 +01:00
|
|
|
|
|
|
|
- name: intel xorg config snippet
|
|
|
|
template:
|
|
|
|
src: templates/20-intel.conf.j2
|
|
|
|
dest: /etc/X11/xorg.conf.d/20-intel.conf
|
|
|
|
when:
|
2019-05-23 17:10:19 +02:00
|
|
|
- intel_detected | bool and not nvidia_detected | bool
|
2019-02-04 17:57:34 +01:00
|
|
|
|
|
|
|
- name: server flags config snippet to disable screen blanking
|
|
|
|
template:
|
|
|
|
src: templates/10-serverflags.conf.j2
|
|
|
|
dest: /etc/X11/xorg.conf.d/10-serverflags.conf
|