Skip to content

Commit 07ed822

Browse files
committed
compute init node condition based off metadata
1 parent e3ce492 commit 07ed822

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

ansible/roles/compute_init/files/compute-init.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
become: yes
66
vars:
77
os_metadata: "{{ lookup('url', 'http://169.254.169.254/openstack/latest/meta_data.json') | from_json }}"
8+
iam_slurm_compute: "{{ os_metadata.meta.slurm_compute | default(false) }}"
89
server_node_ip: "{{ os_metadata.meta.k3s_server }}"
910

1011
resolv_conf_nameservers: [1.1.1.1, 8.8.8.8]
@@ -41,6 +42,11 @@
4142
openhpc_conf_server: "{{ server_node_ip }}"
4243

4344
tasks:
45+
- name: Skip initialization if slurm_compute metadata set to false
46+
debug:
47+
msg: "Skipping compute initialization"
48+
when: not iam_slurm_compute | bool
49+
4450
- name: Configure resolve.conf
4551
block:
4652
- name: Set nameservers in /etc/resolv.conf
@@ -65,7 +71,9 @@
6571
name: NetworkManager
6672
state: reloaded
6773
when: _copy_nm_config.changed | default(false)
68-
when: resolv_conf_nameservers is defined and resolv_conf_nameservers | length > 0
74+
when:
75+
- resolv_conf_nameservers is defined and resolv_conf_nameservers | length > 0
76+
- iam_slurm_compute | bool
6977

7078

7179
- name: Mount /mnt/cluster on compute nodes and copy hosts to /etc/hosts
@@ -91,6 +99,7 @@
9199
owner: root
92100
group: root
93101
mode: 0644
102+
when: iam_slurm_compute | bool
94103

95104
# - name: Include hostvars from NFS share
96105
# block:
@@ -103,6 +112,7 @@
103112
# - name: Include vars from NFS mount
104113
# include_vars:
105114
# file: "/mnt/cluster/{{ short_hostname.stdout }}/hostvars.yml"
115+
# when: iam_slurm_compute | bool
106116

107117

108118
- name: NFS client mount
@@ -121,6 +131,7 @@
121131
fstype: nfs
122132
state: "{{ item.get('nfs_client_mnt_state', nfs_client_mnt_state) }}"
123133
loop: "{{ nfs_configurations }}"
134+
when: iam_slurm_compute | bool
124135

125136

126137
- name: Manila mount
@@ -205,6 +216,7 @@
205216
loop_control:
206217
label: "{{ item.share_name }}"
207218
when: item.mount_state | default(os_manila_mount_state) in ['mounted' or 'ephemeral']
219+
when: iam_slurm_compute | bool
208220

209221

210222
- name: Basic users setup
@@ -229,6 +241,7 @@
229241
loop_control:
230242
label: "{{ item.name }}"
231243
when: "'sudo' in item"
244+
when: iam_slurm_compute | bool
232245

233246

234247
- name: Configure EESSI
@@ -245,6 +258,7 @@
245258
- name: Ensure CVMFS config is setup
246259
command:
247260
cmd: "cvmfs_config setup"
261+
when: iam_slurm_compute | bool
248262

249263

250264
- name: Configure openhpc
@@ -285,4 +299,5 @@
285299
service:
286300
name: slurmd
287301
enabled: true
288-
state: started
302+
state: started
303+
when: iam_slurm_compute | bool

environments/common/layouts/everything

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ cluster
8484

8585
[compute_init:children]
8686
# Hosts to deploy compute initialisation ansible-init script to.
87-
compute
87+
cluster
8888

8989
[k3s:children]
9090
# Hosts to run k3s server/agent

0 commit comments

Comments
 (0)