From 285020e93200de154f2632b6ed2a18a97c7324df Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Thu, 23 Feb 2017 14:24:27 +1100
Subject: [PATCH] tempalte xorg.conf when running on a node with 1GPU (this
 template works for M3 K1 nodes, will need to do something smarter for other
 clusters with GPUS)

---
 roles/gpu/tasks/main.yml         |  6 ++++++
 roles/gpu/templates/xorg.conf.j2 | 14 +++++---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/roles/gpu/tasks/main.yml b/roles/gpu/tasks/main.yml
index f4b2d058..46b8a0a9 100644
--- a/roles/gpu/tasks/main.yml
+++ b/roles/gpu/tasks/main.yml
@@ -141,3 +141,9 @@
   become_user: root
   args: 
     creates: /etc/X11/xorg.conf
+
+- name: Template xorg.conf for nodes with one GPU
+  template: src=xorg.conf.j2 dest=/etc/X11/xorg.conf
+  become: true
+  become_user: root
+  when: template_xorgconf is defined and template_xorgconf
diff --git a/roles/gpu/templates/xorg.conf.j2 b/roles/gpu/templates/xorg.conf.j2
index b6df768f..8af63859 100644
--- a/roles/gpu/templates/xorg.conf.j2
+++ b/roles/gpu/templates/xorg.conf.j2
@@ -1,9 +1,5 @@
 # nvidia-xconfig: X configuration file generated by nvidia-xconfig
-# nvidia-xconfig:  version 340.58  (buildmeister@swio-display-x86-rhel47-09)  Fri Oct 31 17:40:05 PDT 2014
-Section "DRI"
-	Mode 0660
-	Group "vglusers"
-EndSection
+# nvidia-xconfig:  version 352.93  (buildmeister@swio-display-x86-rhel47-07)  Tue Apr  5 18:55:28 PDT 2016
 
 Section "ServerLayout"
     Identifier     "Layout0"
@@ -27,11 +23,9 @@ Section "InputDevice"
 EndSection
 
 Section "InputDevice"
-    # generated from data in "/etc/sysconfig/keyboard"
+    # generated from default
     Identifier     "Keyboard0"
     Driver         "kbd"
-    Option         "XkbLayout" "us"
-    Option         "XkbModel" "pc105"
 EndSection
 
 Section "Monitor"
@@ -47,7 +41,8 @@ Section "Device"
     Identifier     "Device0"
     Driver         "nvidia"
     VendorName     "NVIDIA Corporation"
-    BusID          "PCI:00:06:0"
+    BoardName      "GRID K1"
+    BusID          "PCI:0:6:0"
 EndSection
 
 Section "Screen"
@@ -55,6 +50,7 @@ Section "Screen"
     Device         "Device0"
     Monitor        "Monitor0"
     DefaultDepth    24
+    Option         "UseDisplayDevice" "none"
     SubSection     "Display"
         Depth       24
     EndSubSection
-- 
GitLab