From bfe0907a5919a77a1a9c972a86138c246f17b85d Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Tue, 4 Apr 2017 11:22:04 -0400 Subject: [PATCH] Slurm role improvements: - Have it create its own user account if so configured, since relying on the users common role tramples other group_users configs. - Don't have it set up its own yum repo since the same yum repo is used by other things and was being used multiple times. --- tasks/main.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 25bec87..3eb700f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,21 +3,30 @@ - name: Include OS vars include_vars: "{{ ansible_os_family | lower }}.yml" +- name: Create slurm group + group: + name: "{{ slurm_user.name | default('slurm') }}" + gid: "{{ slurm_user.gid | default(omit) }}" + system: "{{ slurm_user.system | default('yes') }}" + when: slurm_user is defined + +- name: Create slurm user + user: + name: "{{ slurm_user.name | default('slurm') }}" + comment: "{{ slurm_user.comment | default(omit) }}" + uid: "{{ slurm_user.uid | default(omit) }}" + group: "{{ slurm_user.group | default(slurm_user.name | default('slurm')) }}" + groups: "{{ slurm_user.groups | default(omit) }}" + home: "{{ slurm_user.home | default(omit) }}" + shell: "{{ slurm_user.shell | default(omit) }}" + system: "{{ slurm_user.system | default('yes') }}" + when: slurm_user is defined + - name: Install Slurm (apt) apt: pkg: slurm-llnl when: ansible_os_family == "Debian" -- name: Configure slurm yum repository - action: - module: yum_repository - args: - baseurl: "{{ slurm_yum_repo_baseurl }}" - description: "Galaxy Slurm repo" - name: galaxy_slurm - gpgcheck: 0 - when: ansible_os_family == "RedHat" and slurm_yum_repo_baseurl is defined - - name: Install Slurm (yum) yum: name: "{{ item }}" @@ -41,7 +50,7 @@ # FIXME: this task will fail if slurmservers[0] has not already completed the slurm.conf task that follows it - name: Acquire hostlist command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }} - with_items: slurm_nodes + with_items: "{{ slurm_nodes | default([]) }}" delegate_to: "{{ groups['slurmservers'][0] }}" run_once: true register: slurm_hostlists