Skip to content

Commit dd53088

Browse files
committed
Add support for Slurm Topology
Create a new variable slurm_topology_config to define the content of the topology.conf file and ensure TopologyPlugin is defined in slurm.conf when the topology must be configured.
1 parent 1c0efb6 commit dd53088

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ permissions.
8989
Note that this role requires root access, so enable ``become`` either globally in your playbook / on the commandline or
9090
just for the role like [shown below](#example-playbooks).
9191

92+
## Topology Configuration
93+
94+
To configure Slurm topology, define the `slurm_topology_config` variable as a
95+
text block containing the desired content for `topology.conf`.
96+
97+
**Important:** If you set `slurm_topology_config`, you must also set
98+
`TopologyPlugin` in your `slurm_config` (e.g., `TopologyPlugin:
99+
topology/tree`).
100+
101+
Example:
102+
```yaml
103+
slurm_topology_config: |
104+
SwitchName=s0 Nodes=tux[0-1]
105+
SwitchName=s1 Nodes=tux[2-3]
106+
SwitchName=s2 Switches=s[0-1]
107+
108+
slurm_config:
109+
TopologyPlugin: "topology/tree"
110+
# ... other config ...
111+
```
112+
113+
The `topology.conf` file will only be deployed to controller nodes (those
114+
running `slurmctld`).
115+
92116
Dependencies
93117
------------
94118

tasks/slurmctld.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,21 @@
4747

4848
- name: Include job_submit.lua installation tasks
4949
ansible.builtin.include_tasks: job_submit_lua.yml
50-
when: slurm_job_submit_lua is defined
50+
when: slurm_job_submit_lua is defined
51+
52+
- name: Fail if slurm_topology_config is set but TopologyPlugin is not defined
53+
ansible.builtin.fail:
54+
msg: "slurm_topology_config is set, but TopologyPlugin is not defined in slurm_config. Please set TopologyPlugin (e.g., 'topology/tree')."
55+
when:
56+
- slurm_topology_config is defined
57+
- (slurm_config.TopologyPlugin is not defined) or (slurm_config.TopologyPlugin | length == 0)
58+
59+
- name: Deploy topology.conf if slurm_topology_config is defined
60+
ansible.builtin.copy:
61+
content: "{{ slurm_topology_config }}"
62+
dest: "{{ slurm_config_dir }}/topology.conf"
63+
owner: root
64+
group: root
65+
mode: 0644
66+
when:
67+
- slurm_topology_config is defined

0 commit comments

Comments
 (0)