91
91
fstype : nfs
92
92
opts : rw,sync
93
93
state : mounted
94
+ register : nfs_mount_result
95
+ ignore_errors : true
96
+
97
+ - name : Fail gracefully if NFS mount is not available
98
+ debug :
99
+ msg : " NFS mount failed. Skipping compute initialization. Re-image if this persists."
100
+ when : nfs_mount_result.failed
94
101
95
102
- name : Copy /mnt/cluster/hosts contents to /etc/hosts
96
103
copy :
99
106
owner : root
100
107
group : root
101
108
mode : 0644
109
+ when : not nfs_mount_result.failed
102
110
when : iam_slurm_compute | bool
103
111
104
- # - name: Include hostvars from NFS share
105
- # block:
106
- # - name: Extract short hostname using a shell block
107
- # shell: |
108
- # HOSTNAME=$(hostname)
109
- # echo "${HOSTNAME%.test.invalid}"
110
- # register: short_hostname
111
112
112
- # - name: Include vars from NFS mount
113
- # include_vars:
114
- # file: "/mnt/cluster/{{ short_hostname.stdout }}/hostvars.yml"
115
- # when: iam_slurm_compute | bool
113
+ - name : Include hostvars from NFS share
114
+ block :
115
+ - name : Extract short hostname using a shell block
116
+ shell : |
117
+ HOSTNAME=$(hostname)
118
+ echo "${HOSTNAME%.test.invalid}"
119
+ register : short_hostname
120
+
121
+ - name : Include vars from NFS mount
122
+ include_vars :
123
+ file : " /mnt/cluster/{{ short_hostname.stdout }}/hostvars.yml"
124
+ when :
125
+ - iam_slurm_compute | bool
126
+ - not nfs_mount_result.failed
116
127
117
128
118
129
- name : NFS client mount
131
142
fstype : nfs
132
143
state : " {{ item.get('nfs_client_mnt_state', nfs_client_mnt_state) }}"
133
144
loop : " {{ nfs_configurations }}"
134
- when : iam_slurm_compute | bool
145
+ when :
146
+ - iam_slurm_compute | bool
147
+ - not nfs_mount_result.failed
135
148
136
149
137
150
- name : Manila mount
216
229
loop_control :
217
230
label : " {{ item.share_name }}"
218
231
when : item.mount_state | default(os_manila_mount_state) in ['mounted' or 'ephemeral']
219
- when : iam_slurm_compute | bool
232
+ when :
233
+ - iam_slurm_compute | bool
234
+ - not nfs_mount_result.failed
220
235
221
236
222
237
- name : Basic users setup
241
256
loop_control :
242
257
label : " {{ item.name }}"
243
258
when : " 'sudo' in item"
244
- when : iam_slurm_compute | bool
259
+ when :
260
+ - iam_slurm_compute | bool
261
+ - not nfs_mount_result.failed
245
262
246
263
247
264
- name : Configure EESSI
258
275
- name : Ensure CVMFS config is setup
259
276
command :
260
277
cmd : " cvmfs_config setup"
261
- when : iam_slurm_compute | bool
278
+ when :
279
+ - iam_slurm_compute | bool
280
+ - not nfs_mount_result.failed
262
281
263
282
264
283
- name : Configure openhpc
300
319
name : slurmd
301
320
enabled : true
302
321
state : started
303
- when : iam_slurm_compute | bool
322
+ when :
323
+ - iam_slurm_compute | bool
324
+ - not nfs_mount_result.failed
0 commit comments