From 4d393d924f5e8bdaffb457ebad93145a11f981b2 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Fri, 19 Jan 2018 07:51:38 +0100 Subject: [PATCH] Write data from xorg-detect as local facts for futher usage --- Manual.org | 17 +++++++---------- roles/yavdr-xorg/defaults/main.yml | 1 - roles/yavdr-xorg/tasks/detect-xorg.yml | 17 +++++++---------- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Manual.org b/Manual.org index 10ca296..233eb48 100644 --- a/Manual.org +++ b/Manual.org @@ -1908,18 +1908,15 @@ first_run: False state: directory path: /etc/ansible/facts.d - - name: set xorg and xrandr in xorg_data dictionary - set_fact: - xorg_data: '{{ xorg_data|combine({"xorg": xorg, "xrandr": xrandr}) }}' - - - name: print xorg_data - debug: - var: xorg_data - - - name: write xorg variable to /etc/yavdr/xorg.yml + - name: write xorg variable as local fact copy: - content: '{{ xorg_data | to_nice_json }}' + content: '{{ {"xorg": xorg} | to_nice_json }}' dest: /etc/ansible/facts.d/xorg.fact + + - name: write xrandr variable as local fact + copy: + content: '{{ {"xrandr": xrandr} | to_nice_json }}' + dest: /etc/ansible/facts.d/xrandr.fact when: - xrandr is defined - xorg is defined diff --git a/roles/yavdr-xorg/defaults/main.yml b/roles/yavdr-xorg/defaults/main.yml index 05e3e3a..fffb828 100644 --- a/roles/yavdr-xorg/defaults/main.yml +++ b/roles/yavdr-xorg/defaults/main.yml @@ -1,2 +1 @@ first_run: False -xorg_data: {} diff --git a/roles/yavdr-xorg/tasks/detect-xorg.yml b/roles/yavdr-xorg/tasks/detect-xorg.yml index 5c2888e..6da5e7c 100644 --- a/roles/yavdr-xorg/tasks/detect-xorg.yml +++ b/roles/yavdr-xorg/tasks/detect-xorg.yml @@ -106,18 +106,15 @@ state: directory path: /etc/ansible/facts.d - - name: set xorg and xrandr in xorg_data dictionary - set_fact: - xorg_data: '{{ xorg_data|combine({"xorg": xorg, "xrandr": xrandr}) }}' - - - name: print xorg_data - debug: - var: xorg_data - - - name: write xorg variable to /etc/yavdr/xorg.yml + - name: write xorg variable as local fact copy: - content: '{{ xorg_data | to_nice_json }}' + content: '{{ {"xorg": xorg} | to_nice_json }}' dest: /etc/ansible/facts.d/xorg.fact + + - name: write xrandr variable as local fact + copy: + content: '{{ {"xrandr": xrandr} | to_nice_json }}' + dest: /etc/ansible/facts.d/xrandr.fact when: - xrandr is defined - xorg is defined