Skip to content

Commit c7f894b

Browse files
Make sure the topology file is recreated properly
1 parent c20ef90 commit c7f894b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

playbooks/roles/slurm/tasks/server.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,30 @@
198198
nodesname_list: "{{temp_list.split(',')[:-1] }}"
199199
when: not initial_topology.changed
200200

201+
- name: Check if shapes need to be added
202+
become: true
203+
lineinfile:
204+
path: "{{ slurm_conf_path }}/topology.conf"
205+
regexp: "SwitchName=inactive-{{item}}\\sNodes.*"
206+
state: absent
207+
check_mode: yes
208+
with_items: "{{nodesname_list}}"
209+
run_once: true
210+
delegate_to: 127.0.0.1
211+
register: shape_added
212+
when: not initial_topology.changed
213+
201214
- name: Add new shapes to existing topology.conf
202215
become: true
203216
vars:
204217
size: "{{ hostvars[inventory_hostname]['private_subnet'] | ipaddr('size') }}"
205218
lineinfile:
206219
path: "{{ slurm_conf_path }}/topology.conf"
207-
regexp: "SwitchName=inactive-{{item}}\\sNodes.*"
208-
line: "SwitchName=inactive-{{item}} Nodes={{item}}-node-[1-{{size}}]"
220+
regexp: "SwitchName=inactive-{{item.item}}\\sNodes.*"
221+
line: "SwitchName=inactive-{{item.item}} Nodes={{item.item}}-node-[1-{{size}}]"
209222
state: present
210-
with_items: "{{nodesname_list}}"
223+
with_items: "{{shape_added.results}}"
211224
run_once: true
212225
delegate_to: 127.0.0.1
213-
when: not initial_topology.changed
226+
when: not initial_topology.changed and not ( item.changed | bool)
214227
notify: reconfigure slurm

0 commit comments

Comments
 (0)