2016-04-05 18:35:18 -03:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Include OS vars
|
|
|
|
include_vars: "{{ ansible_os_family | lower }}.yml"
|
|
|
|
|
2017-04-04 12:22:04 -03:00
|
|
|
- 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
|
|
|
|
|
2017-06-01 13:52:44 -03:00
|
|
|
- name: Include controller installation tasks
|
|
|
|
include: slurmctld.yml
|
2019-01-26 16:47:07 -04:00
|
|
|
when: "'slurmservers' in group_names or 'controller' in slurm_roles"
|
2017-06-01 13:52:44 -03:00
|
|
|
|
|
|
|
- name: Include execution host installation tasks
|
|
|
|
include: slurmd.yml
|
2019-01-26 16:47:07 -04:00
|
|
|
when: "'slurmexechosts' in group_names or 'exec' in slurm_roles"
|
2017-06-01 13:52:44 -03:00
|
|
|
|
|
|
|
- name: Include DB installation tasks
|
|
|
|
include: slurmdbd.yml
|
2019-01-26 16:47:07 -04:00
|
|
|
when: "'slurmdbdservers' in group_names 'dbd' in slurm_roles"
|
2017-06-01 13:52:44 -03:00
|
|
|
|
|
|
|
- name: Install Slurm client (apt)
|
2016-04-05 18:35:18 -03:00
|
|
|
apt:
|
2017-06-01 13:52:44 -03:00
|
|
|
name: "{{ item }}"
|
2018-04-17 16:37:35 -03:00
|
|
|
state: "{{ 'latest' if slurm_upgrade else 'present' }}"
|
2016-04-05 18:35:18 -03:00
|
|
|
when: ansible_os_family == "Debian"
|
2017-06-01 13:52:44 -03:00
|
|
|
with_items:
|
|
|
|
- slurm-client
|
|
|
|
- slurm-wlm-doc
|
2016-04-05 18:35:18 -03:00
|
|
|
|
|
|
|
- name: Install Slurm (yum)
|
|
|
|
yum:
|
|
|
|
name: "{{ item }}"
|
2018-04-17 16:37:35 -03:00
|
|
|
state: "{{ 'latest' if slurm_upgrade else 'present' }}"
|
2016-04-05 18:35:18 -03:00
|
|
|
with_items:
|
|
|
|
- slurm
|
2018-04-17 16:37:35 -03:00
|
|
|
- munge
|
|
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
|
|
|
|
# As of 17.11, this is only created if you install the example configs package
|
2018-04-17 20:28:48 -03:00
|
|
|
- name: Create /etc/slurm
|
2018-04-17 16:37:35 -03:00
|
|
|
file:
|
|
|
|
path: /etc/slurm
|
|
|
|
state: directory
|
2016-04-05 18:35:18 -03:00
|
|
|
when: ansible_os_family == "RedHat"
|
2018-04-17 20:28:48 -03:00
|
|
|
|
|
|
|
- name: Install log rotation configuration
|
|
|
|
copy:
|
|
|
|
src: logrotate-slurm
|
|
|
|
dest: /etc/logrotate.d/slurm
|
|
|
|
when: ansible_os_family == "RedHat"
|
2016-04-05 18:35:18 -03:00
|
|
|
|
2017-02-21 18:18:42 -04:00
|
|
|
# FIXME: this task will fail if slurmservers[0] has not already completed the slurm.conf task that follows it
|
2016-09-22 12:02:36 -03:00
|
|
|
- name: Acquire hostlist
|
|
|
|
command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }}
|
2017-04-04 12:22:04 -03:00
|
|
|
with_items: "{{ slurm_nodes | default([]) }}"
|
2017-02-21 18:18:42 -04:00
|
|
|
delegate_to: "{{ groups['slurmservers'][0] }}"
|
|
|
|
run_once: true
|
2016-09-22 12:02:36 -03:00
|
|
|
register: slurm_hostlists
|
|
|
|
|
2016-04-05 18:35:18 -03:00
|
|
|
- name: Install slurm.conf
|
|
|
|
template:
|
2016-04-07 18:10:18 -03:00
|
|
|
src: "{{ slurm_conf_src | default( 'templates/slurm/slurm.conf.j2' ) }}"
|
2016-04-05 18:35:18 -03:00
|
|
|
dest: "{{ slurm_conf_dir }}/slurm.conf"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0444
|
|
|
|
notify:
|
2016-04-15 13:01:32 -03:00
|
|
|
- restart slurmd
|
|
|
|
- restart slurmctld
|
2016-04-05 18:35:18 -03:00
|
|
|
|
|
|
|
- name: Check munge dir
|
|
|
|
file:
|
|
|
|
path: /etc/munge
|
|
|
|
owner: munge
|
|
|
|
group: munge
|
|
|
|
mode: 0700
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Install munge key
|
|
|
|
action:
|
|
|
|
module: decode
|
|
|
|
args:
|
|
|
|
content: "{{ munge_key }}"
|
|
|
|
dest: /etc/munge/munge.key
|
|
|
|
filter: base64
|
|
|
|
owner: munge
|
|
|
|
group: munge
|
|
|
|
mode: 0400
|
|
|
|
|
|
|
|
# /var/log on Ubuntu 14.04+ is group writable, which causes munge to refuse to start
|
|
|
|
# NOTE: This is fixed in munge 0.5.12
|
|
|
|
- name: Check /var/log permissions
|
|
|
|
stat:
|
|
|
|
path: /var/log
|
|
|
|
register: stat_var_log
|
2017-06-01 13:52:44 -03:00
|
|
|
when: ansible_distribution == "Ubuntu"
|
2016-04-05 18:35:18 -03:00
|
|
|
|
|
|
|
- name: Force munge to start with "insecure" /var/log permissions
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/default/munge
|
|
|
|
line: 'OPTIONS="--force"'
|
|
|
|
regexp: ^OPTIONS=
|
2017-06-01 13:52:44 -03:00
|
|
|
when: ansible_distribution == "Ubuntu" and stat_var_log.stat.wgrp
|
2016-04-05 18:35:18 -03:00
|
|
|
|
|
|
|
- name: Ensure Munge is running
|
|
|
|
service:
|
|
|
|
name: munge
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
|
2017-06-01 13:52:44 -03:00
|
|
|
- name: Ensure slurmdbd is running
|
2016-04-05 18:35:18 -03:00
|
|
|
service:
|
2017-06-01 13:52:44 -03:00
|
|
|
name: "{{ slurmdbd_service_name }}"
|
2016-04-05 18:35:18 -03:00
|
|
|
enabled: yes
|
|
|
|
state: started
|
2019-01-26 16:47:07 -04:00
|
|
|
when: "'slurmdbdservers' in group_names 'dbd' in slurm_roles"
|
2016-04-05 18:35:18 -03:00
|
|
|
|
|
|
|
- name: Ensure slurmctld is running
|
|
|
|
service:
|
|
|
|
name: "{{ slurmctld_service_name }}"
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
2019-01-26 16:47:07 -04:00
|
|
|
when: "'slurmservers' in group_names or 'controller' in slurm_roles"
|
2016-04-05 18:35:18 -03:00
|
|
|
|
2017-06-01 13:52:44 -03:00
|
|
|
- name: Ensure slurmd is running
|
2016-04-05 18:35:18 -03:00
|
|
|
service:
|
2017-06-01 13:52:44 -03:00
|
|
|
name: "{{ slurmd_service_name }}"
|
2016-04-05 18:35:18 -03:00
|
|
|
enabled: yes
|
|
|
|
state: started
|
2019-01-26 16:47:07 -04:00
|
|
|
when: "'slurmexechosts' in group_names or 'exec' in slurm_roles"
|