Skip to content

Commit e5897b7

Browse files
authored
Improve behaviour when switching configless mode off (#178)
* Fix openhpc_configless when set to false Need to pass this through the bool filter so that string values are interpreted as booleans. * Remove conf-server command line option if configless mode is disabled
1 parent 3e3976b commit e5897b7

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

tasks/runtime.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
ansible.builtin.tempfile:
8585
register: _slurm_conf_tmpfile
8686
delegate_to: localhost
87-
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless
87+
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool
8888
changed_when: false # so molecule doesn't fail
8989
become: no
9090

@@ -95,7 +95,7 @@
9595
lstrip_blocks: true
9696
mode: 0644
9797
delegate_to: localhost
98-
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless
98+
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool
9999
changed_when: false # so molecule doesn't fail
100100
become: no
101101

@@ -110,7 +110,7 @@
110110
mode: 0644
111111
loop: "{{ openhpc_config | dict2items }}"
112112
delegate_to: localhost
113-
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless
113+
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool
114114
changed_when: false # so molecule doesn't fail
115115
become: no
116116

@@ -121,7 +121,7 @@
121121
owner: root
122122
group: root
123123
mode: 0644
124-
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless
124+
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool
125125
notify:
126126
- Restart slurmctld service
127127
register: ohpc_slurm_conf
@@ -134,7 +134,7 @@
134134
mode: "0600"
135135
owner: slurm
136136
group: slurm
137-
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless
137+
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool
138138
notify:
139139
- Restart slurmctld service
140140
register: ohpc_gres_conf
@@ -148,7 +148,7 @@
148148
mode: "0644" # perms/ownership based off src from ohpc package
149149
owner: root
150150
group: root
151-
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless
151+
when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool
152152

153153
- name: Remove local tempfile for slurm.conf templating
154154
ansible.builtin.file:
@@ -169,18 +169,20 @@
169169
notify:
170170
- Restart slurmd service
171171

172-
- name: Set slurmctld location for configless operation
172+
- name: Configure slurmd command line options
173+
vars:
174+
slurmd_options_configless: "--conf-server {{ openhpc_slurm_control_host_address | default(openhpc_slurm_control_host) }}"
175+
slurmd_options: ""
173176
lineinfile:
174177
path: /etc/sysconfig/slurmd
175-
line: "SLURMD_OPTIONS='--conf-server {{ openhpc_slurm_control_host_address | default(openhpc_slurm_control_host) }}'"
178+
line: "SLURMD_OPTIONS='{{ slurmd_options_configless if openhpc_slurm_configless | bool else slurmd_options }}'"
176179
regexp: "^SLURMD_OPTIONS="
177180
create: yes
178181
owner: root
179182
group: root
180183
mode: 0644
181184
when:
182185
- openhpc_enable.batch | default(false)
183-
- openhpc_slurm_configless
184186
notify:
185187
- Restart slurmd service
186188
# Reloading is sufficent, but using a single handler means no bounce. Realistically this won't regularly change on a running slurmd so restarting is ok.

templates/slurm.conf.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,6 @@ PartitionName={{part.name}} Default={{ part.get('default', 'YES') }} MaxTime={{
184184
# Define a non-existent node, in no partition, so that slurmctld starts even with all partitions empty
185185
NodeName=nonesuch
186186

187-
{% if openhpc_slurm_configless %}SlurmctldParameters=enable_configless{% endif %}
187+
{% if openhpc_slurm_configless | bool %}SlurmctldParameters=enable_configless{% endif %}
188188

189189
ReturnToService=2

0 commit comments

Comments
 (0)