From c9c647a608e34de3125294966fb898ee8b9824d0 Mon Sep 17 00:00:00 2001
From: Damien Leong <damien@dyn-49-127-98-19.its.monash.edu.au>
Date: Wed, 13 Mar 2019 17:36:04 +1100
Subject: [PATCH] Add pam_slurm_adopt

---
 roles/pam_slurm/templates/sshd.j2             |  2 +-
 .../tasks/installSlurmFromSource.yml          | 20 +++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/roles/pam_slurm/templates/sshd.j2 b/roles/pam_slurm/templates/sshd.j2
index a1218458..fea4fda0 100644
--- a/roles/pam_slurm/templates/sshd.j2
+++ b/roles/pam_slurm/templates/sshd.j2
@@ -6,7 +6,7 @@ auth       include      postlogin
 -auth      optional     pam_reauthorize.so prepare
 account    required     pam_nologin.so
 account    include      password-auth
-account    sufficient   pam_slurm.so
+account    sufficient   pam_slurm_adopt.so
 account    required     pam_access.so
 password   include      password-auth
 # pam_selinux.so close should be the first session rule
diff --git a/roles/slurm-common/tasks/installSlurmFromSource.yml b/roles/slurm-common/tasks/installSlurmFromSource.yml
index 167994b2..2e89dc98 100644
--- a/roles/slurm-common/tasks/installSlurmFromSource.yml
+++ b/roles/slurm-common/tasks/installSlurmFromSource.yml
@@ -8,20 +8,20 @@
   sudo: true 
   when: force_slurm_recompile is defined
 
-
 - name: unarchive slurm
   unarchive:
-  args:
     src: "http://consistency0/src/slurm-{{ slurm_version }}.tar.bz2"
-    copy: no
     dest: /tmp
+    remote_src: yes
     creates: "{{ slurm_dir }}/bin/srun"
 
 - name: stat srun
   stat: path="{{ slurm_dir }}/bin/srun"
   register: stat_srun
 
-
+- name: stat pam_slurm_adopt
+  stat: path="/lib64/security/pam_slurm_adopt.so"
+  register: stat_pam_slurm_adopt
 
 - name: configure slurm
   command: /tmp/slurm-{{ slurm_version }}/configure --prefix={{ slurm_dir }} --with-munge={{ munge_dir }} --enable-pam 
@@ -58,6 +58,18 @@
     chdir: /tmp/slurm-{{ slurm_version }}/contribs/pam
   when: force_slurm_recompile is defined or not stat_srun.stat.exists
 
+- name: build pam_slurm_adopt
+  make:
+    chdir: /tmp/slurm-{{ slurm_version }}/contribs/pam_slurm_adopt
+  when: force_slurm_recompile is defined or not stat_pam_slurm_adopt.stat.exists
+
+- name: install pam_slurm_adopt
+  make:
+    chdir: /tmp/slurm-{{ slurm_version }}/contribs/pam_slurm_adopt
+    target: install
+  when: force_slurm_recompile is defined or not stat_pam_slurm_adopt.stat.exists
+  sudo: true
+
 - name: add slurm log rotate config
   template: src=slurmlog.j2 dest=/etc/logrotate.d/slurm mode=644
   sudo: true
-- 
GitLab