From 87be8ba7b548fd46d7ec2c03178bf4306847c3f0 Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Tue, 26 Apr 2016 23:15:17 +0000
Subject: [PATCH] split the nhc config out of the slurm-common role

---
 roles/calculateNhcConfig/tasks/main.yml       |  8 +++++
 .../calculateNhcConfig/templates/nhc.conf.j2  | 29 +++++++++++++++++++
 roles/slurm-common/tasks/installNhc.yml       | 21 +++-----------
 3 files changed, 41 insertions(+), 17 deletions(-)
 create mode 100644 roles/calculateNhcConfig/tasks/main.yml
 create mode 100644 roles/calculateNhcConfig/templates/nhc.conf.j2

diff --git a/roles/calculateNhcConfig/tasks/main.yml b/roles/calculateNhcConfig/tasks/main.yml
new file mode 100644
index 00000000..b6f9f9f7
--- /dev/null
+++ b/roles/calculateNhcConfig/tasks/main.yml
@@ -0,0 +1,8 @@
+---
+- name: "Templating nhc.conf"
+  template: src=nhc.conf.j2 dest=/tmp/nhc.conf owner=root group=root mode=644
+  sudo: true
+
+- name: fetch nhc.conf
+  fetch: src=/tmp/nhc.conf dest=files/nhc.conf flat=yes
+
diff --git a/roles/calculateNhcConfig/templates/nhc.conf.j2 b/roles/calculateNhcConfig/templates/nhc.conf.j2
new file mode 100644
index 00000000..a5921218
--- /dev/null
+++ b/roles/calculateNhcConfig/templates/nhc.conf.j2
@@ -0,0 +1,29 @@
+
+
+#######################################################################
+###
+### Filesystem checks
+###
+# * || check_fs_mount_rw -t "fuse.glusterfs" -s "mgmt0:/gv" -f "/glusterVolume"
+ * || check_fs_used / 90%
+# * || check_fs_used /glusterVolume 90%
+ * || check_fs_iused / 100%
+# * || check_fs_iused /glusterVolume 100%
+
+
+#######################################################################
+###
+### Hardware checks
+###
+ * || check_hw_cpuinfo 1 1 1
+# * || check_hw_physmem 4048416kB 4048416kB 3%
+ * || check_hw_swap 0kB 0kB 3%
+ * || check_hw_eth eth0
+ * || check_hw_eth lo
+
+
+#######################################################################
+###
+### Process checks
+###
+ * || check_ps_service -S -u root sshd
diff --git a/roles/slurm-common/tasks/installNhc.yml b/roles/slurm-common/tasks/installNhc.yml
index 8889a929..1b093c6d 100644
--- a/roles/slurm-common/tasks/installNhc.yml
+++ b/roles/slurm-common/tasks/installNhc.yml
@@ -47,20 +47,7 @@
   template: dest=/etc/logrotate.d/nhc src=nhclog.j2 mode=644
   sudo: true
 
-- name: check configure file
-  shell: ls {{ nhc_dir }}/etc/nhc/{{ nhc_config_file }}
-  ignore_errors: true
-  register: generate_nhc_config_file 
-
-- name: generate config file
-  shell: "{{ nhc_dir }}/sbin/nhc-genconf -c {{ nhc_dir }}/etc/nhc/{{ nhc_config_file }} CONFDIR={{ nhc_dir }}/etc/nhc"
-  sudo: true
-  ignore_errors: true
-  when: generate_nhc_config_file 
-
-- name: config file extension
-  lineinfile: dest="{{ nhc_dir }}/etc/nhc/{{ nhc_config_file }}" line="{{ item }}"
-  with_items:
-    nhc_user_conf
-  sudo: true
-  when: nhc_user_conf is defined and generate_nhc_config_file
\ No newline at end of file
+- name: install nhc config file
+  copy: src=nhc.conf dest={{ nhc_dir }}/etc/nhc/{{ nhc_config_file }}
+  become: true
+  become_user: root
-- 
GitLab