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.
This commit is contained in:
Nate Coraor 2017-04-04 11:22:04 -04:00
parent 648e1c2710
commit bfe0907a59
1 changed files with 20 additions and 11 deletions

View File

@ -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