From 9ef798a5560c9b2bf0ffc3b7de4b24f993e0bef3 Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Fri, 20 Mar 2015 01:39:09 +0000
Subject: [PATCH] add a role to start slurm since slurm will have errors if the
 ctrld is started before the dbd

---
 roles/slurm-start/tasks/main.yml | 13 +++++++++++++
 roles/slurmdb/handlers/main.yml  |  8 --------
 roles/slurmdb/tasks/main.yml     | 14 ++++++++++++--
 3 files changed, 25 insertions(+), 10 deletions(-)
 create mode 100644 roles/slurm-start/tasks/main.yml

diff --git a/roles/slurm-start/tasks/main.yml b/roles/slurm-start/tasks/main.yml
new file mode 100644
index 0000000..29f3bc2
--- /dev/null
+++ b/roles/slurm-start/tasks/main.yml
@@ -0,0 +1,13 @@
+---
+- name: start munge
+  service: name=munge state=started
+  sudo: true
+
+- name: start slurmdbd
+  service: name=slurmdbd state=started
+  sudo: true
+  ignore_errors: true
+
+- name: start slurm
+  service: name=slurm state=started
+  sudo: true
diff --git a/roles/slurmdb/handlers/main.yml b/roles/slurmdb/handlers/main.yml
index cbbaae7..e69de29 100644
--- a/roles/slurmdb/handlers/main.yml
+++ b/roles/slurmdb/handlers/main.yml
@@ -1,8 +0,0 @@
----
-  - name: restart slurmdbd
-    service: name={{ item }} state=restarted
-    with_items:
-      - slurmdbd
-      - slurm
-    sudo: true
-
diff --git a/roles/slurmdb/tasks/main.yml b/roles/slurmdb/tasks/main.yml
index f00f19c..14fbda2 100644
--- a/roles/slurmdb/tasks/main.yml
+++ b/roles/slurmdb/tasks/main.yml
@@ -13,12 +13,23 @@
   sudo: true
 
 - name: install mysql local root password 
-  mysql_user: check_implicit_admin=True login_user=root login_password="{{ sqlrootPasswd }}" name=root password="{{ sqlrootPasswd }}" state=present
+  mysql_user: check_implicit_admin=True login_user=root login_password={{ sqlrootPasswd }} name=root password={{ sqlrootPasswd }} state=present
   sudo: true
 
+- name: install slurmdbd init
+  template: src=slurmdbd.initd.j2 dest=/etc/init.d/slurmdbd mode=755
+  sudo: true
+
+- name: install slurmdb.conf init
+  template: src=slurmdbd.conf.j2 dest={{ slurm_dir }}/etc/slurmdbd.conf
+  sudo: true
+  when: slurm_dir is defined
+
+
 - name: install slurmdbd.conf
   template: src=slurmdbd.conf.j2 dest=/etc/slurm/slurmdbd.conf
   sudo: true
+  when: slurm_dir is not defined
 
 - name: configure database slurmdb localhost
   mysql_user: login_user=root login_password="{{ sqlrootPasswd }}" name=slurmdb password="{{ slurmdb_passwd }}" host=localhost priv=*.*:ALL,GRANT state=present
@@ -27,7 +38,6 @@
 - name: configure database slurmdb domain 
   mysql_user: login_user=root login_password="{{ sqlrootPasswd }}" name=slurmdb password="{{ slurmdb_passwd }}" host="{{ ansible_hostname }}"."{{ ansible_domain }}" priv=*.*:ALL,GRANT state=present
   sudo: true
-#  notify: restart slurmdb
 
 - name: sanity check slrumdbd service
   service: "name=slurmdbd enabled=yes state=started"
-- 
GitLab