-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-slurm.yaml
108 lines (106 loc) · 3.23 KB
/
03-slurm.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
- hosts: pakupi_controller
become: yes
tasks:
- name: Install munge on the Controller
package:
name: munge
state: present
- name: Retrieve the munge key from the Controller
fetch:
src: /etc/munge/munge.key
dest: ./files/
# - hosts: localhost
# gather_facts: no
# tasks:
# - name: Validate the Slurm partition definition
# fail:
# msg: "Unknown Ansible group '{{ item }}', please create the group in your inventory or remove the group from `pakupi_slurm_partitions`."
# loop: "{{ pakupi_slurm_partitions }}"
# when: item not in groups
- hosts:
- pakupi_controller
- pakupi_worker
gather_facts: yes
tasks:
- name: "Prevent cloud-init interference with hostname"
become: yes
lineinfile:
path: /etc/cloud/cloud.cfg
regexp: "^preserve_hostname:"
line: "preserve_hostname: true"
- name: "Set hostname to {{ inventory_hostname }}"
become: yes
ansible.builtin.hostname:
name: "{{ inventory_hostname }}"
use: systemd
- name: Build Slurm user information
set_fact:
slurm_user:
uid: "{{ hostvars[groups['pakupi_controller']|first].ansible_user_uid }}"
gid: "{{ hostvars[groups['pakupi_controller']|first].ansible_user_gid }}"
name: "{{ hostvars[groups['pakupi_controller']|first].ansible_user }}"
group: "{{ hostvars[groups['pakupi_controller']|first].ansible_user }}"
slurm_create_user: no
slurm_create_dirs: yes
slurm_nodes: "{{ slurm_nodes }}"
slurm_partitions: "{{ slurm_partitions }}"
slurm_config:
SlurmctldHost: "{{ hostvars[groups['pakupi_controller']|first].inventory_hostname }}"
SlurmctldLogFile: "/var/log/slurm/slurmctld.log"
SlurmdSpoolDir: "/var/lib/slurm/slurmd"
SlurmdLogFile: "/var/log/slurm/slurmd.log"
SlurmctldPidFile: "/var/run/slurm/slurmctld.pid"
SlurmdPidFile: "/var/run/slurm/slurmd.pid"
StateSaveLocation: "/var/lib/slurm/slurmctld"
ReturnToService: 2
slurm_munge_key: "./files/{{ hostvars[groups['pakupi_controller']|first].inventory_hostname }}/etc/munge/munge.key"
slurm_config_dir: "/etc/slurm"
vars:
slurm_partitions: "{{ lookup('template', 'slurm_partitions.yml.j2') }}"
slurm_nodes: "{{ lookup('template', 'slurm_nodes.yml.j2') }}"
- hosts: pakupi_controller
become: yes
tasks:
- name: Setup slurm controller
include_role:
name: galaxyproject.slurm
- name: Create slurm run dir
file:
path: /var/run/slurm-llnl
state: directory
owner: slurm
group: slurm
mode: '0644'
- name: Restart controller
service:
name: slurmctld
state: started
vars:
slurm_roles: ["controller"]
- hosts: pakupi_worker
become: yes
tasks:
- name: Setup slurm workers
include_role:
name: galaxyproject.slurm
- name: Create slurm run dir
file:
path: /var/run/slurm-llnl
state: directory
owner: slurm
group: slurm
mode: '0644'
- name: Create slurm lib dir
file:
path: /var/lib/slurm-llnl
state: directory
owner: slurm
group: slurm
mode: '0644'
- name: Restart controller
service:
name: slurmd
state: started
vars:
slurm_roles: ["exec"]