Write local facts for results of xorg-detect

This commit is contained in:
Alexander Grothe 2018-01-16 14:56:51 +01:00
parent 252cade885
commit b8b86e8a1d
4 changed files with 62 additions and 6338 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1682,6 +1682,7 @@ b'\xde\xad\xbe\xef'
*** default variables *** default variables
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/defaults/main.yml :mkdirp yes :padline no #+BEGIN_SRC yaml :tangle roles/yavdr-xorg/defaults/main.yml :mkdirp yes :padline no
first_run: False first_run: False
xorg_data: {}
#+END_SRC #+END_SRC
*** tasks *** tasks
@ -1889,15 +1890,6 @@ first_run: False
var: xorg.secondary var: xorg.secondary
when: xorg.secondary is defined when: xorg.secondary is defined
- name: write xorg variable to /etc/yavdr/xorg.yml
block:
- file:
state: directory
path: /etc/yavdr
- copy:
content: '{{ xorg | combine(xrandr) | to_nice_yaml }}'
dest: /etc/yavdr/xorg.yml
- name: "stop x-verbose@vt7.service" - name: "stop x-verbose@vt7.service"
systemd: systemd:
name: "x-verbose@vt7.service" name: "x-verbose@vt7.service"
@ -1909,6 +1901,35 @@ first_run: False
wait_for: wait_for:
timeout: 3 timeout: 3
- name: save results
block:
- name: write xorg and xrandr variable to xorg_data dictionary
set_fact:
xorg_data: '{{ xorg_data|combine({item[0]: item[1]}) }}'
with_items:
- ('xorg', xorg)
- ('xrandr', xrandr['Screen 0:'])
- name: write xorg variable to /etc/yavdr/xorg.yml
block:
- file:
state: directory
path: /etc/ansible/facts.d
- copy:
content: '{{ xorg_data | to_nice_json }}'
dest: /etc/ansible/facts.d/xorg.fact
when:
- xrandr is defined
- xorg is defined
- name: update xorg and xrandr variable with values from local facts if needed
set_fact:
xorg: '{{ ansible_local.xorg }}'
xrandr: '{{ ansible_local.xrandr }}'
when:
- xrandr is undefined
- xorg is undefined
# TODO: expand template for xorg.conf (or snippets) # TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver # with respect for the available graphics card driver
# nvidia, noveau, intel, radeon # nvidia, noveau, intel, radeon

View File

@ -1 +1,2 @@
first_run: False first_run: False
xorg_data: {}

View File

@ -88,15 +88,6 @@
var: xorg.secondary var: xorg.secondary
when: xorg.secondary is defined when: xorg.secondary is defined
- name: write xorg variable to /etc/yavdr/xorg.yml
block:
- file:
state: directory
path: /etc/yavdr
- copy:
content: '{{ xorg | combine(xrandr) | to_nice_yaml }}'
dest: /etc/yavdr/xorg.yml
- name: "stop x-verbose@vt7.service" - name: "stop x-verbose@vt7.service"
systemd: systemd:
name: "x-verbose@vt7.service" name: "x-verbose@vt7.service"
@ -108,6 +99,35 @@
wait_for: wait_for:
timeout: 3 timeout: 3
- name: save results
block:
- name: write xorg and xrandr variable to xorg_data dictionary
set_fact:
xorg_data: '{{ xorg_data|combine({item[0]: item[1]}) }}'
with_items:
- ('xorg', xorg)
- ('xrandr', xrandr['Screen 0:'])
- name: write xorg variable to /etc/yavdr/xorg.yml
block:
- file:
state: directory
path: /etc/ansible/facts.d
- copy:
content: '{{ xorg_data | to_nice_json }}'
dest: /etc/ansible/facts.d/xorg.fact
when:
- xrandr is defined
- xorg is defined
- name: update xorg and xrandr variable with values from local facts if needed
set_fact:
xorg: '{{ ansible_local.xorg }}'
xrandr: '{{ ansible_local.xrandr }}'
when:
- xrandr is undefined
- xorg is undefined
# TODO: expand template for xorg.conf (or snippets) # TODO: expand template for xorg.conf (or snippets)
# with respect for the available graphics card driver # with respect for the available graphics card driver
# nvidia, noveau, intel, radeon # nvidia, noveau, intel, radeon