|
21 | 21 | delegate_to: localhost
|
22 | 22 | run_once: true
|
23 | 23 |
|
24 |
| -- name: Check gres configuration when gres_autodetect is set |
| 24 | +- name: Check gres configuration |
25 | 25 | assert:
|
26 | 26 | that:
|
27 |
| - - _failure_reasons | selectattr('when', 'truthy') | length == 0 |
| 27 | + - failure_reasons | length == 0 |
28 | 28 | fail_msg: >
|
29 |
| - Your nodegroup definition must include a single gres dictionary containing a conf key |
30 |
| - if gres_autodetect is set. The following nodegroup failed this check: {{ item }}. |
31 |
| - Reasons for failure: {{ _failure_reasons | selectattr('when', 'truthy') | map(attribute='msg') | join(', ') }} |
| 29 | + Each list item in the gres dictionary of your nodegroup definition must |
| 30 | + contain a conf key. If gres_autodetect is not set, you must also include the |
| 31 | + file key. The following nodegroup failed this check: {{ item }}. Reasons for |
| 32 | + failure: {{ failure_reasons | map(attribute='msg') | join(', ') }} |
32 | 33 | vars:
|
33 |
| - _openhpc_gres_autodetect_groups: "{{ openhpc_nodegroups | selectattr('gres_autodetect', 'defined') | selectattr('gres_autodetect', 'search', '(?!off).*') }}" |
| 34 | + gres_autodetect: "{{ item.gres_autodetect | default('off') }}" |
34 | 35 | _failure_reasons:
|
35 |
| - - msg: The gres key was a list with more than one item |
36 |
| - when: "{{ item.gres | length != 1 }}" |
37 |
| - - msg: The gres dictionary does not contain a conf key |
38 |
| - when: "{{ item.gres.0.conf is not defined }}" |
| 36 | + - msg: One of the gres dictionaries does not contain a file key and gres_autodetect is off. |
| 37 | + condition: "{{ item.gres | rejectattr('file', 'defined') | length > 0 }}" |
| 38 | + when: "{{ gres_autodetect == 'off' }}" |
| 39 | + - msg: One of the gres dictionaries contains a file key and gres_autodetect is set. |
| 40 | + condition: "{{ item.gres | selectattr('file', 'defined') | length > 0 }}" |
| 41 | + when: "{{ gres_autodetect != 'off' }}" |
| 42 | + - msg: One of the gres dictionaries does not contain a conf key |
| 43 | + condition: "{{ item.gres | rejectattr('conf', 'defined') | length > 0 }}" |
| 44 | + when: true |
| 45 | + failure_reasons: "{{ _failure_reasons | selectattr('when', 'truthy') | selectattr('condition', 'truthy') }}" |
39 | 46 | delegate_to: localhost
|
40 |
| - loop: "{{ _openhpc_gres_autodetect_groups }}" |
| 47 | + loop: "{{ openhpc_nodegroups | selectattr('gres', 'defined') }}" |
41 | 48 | run_once: true
|
42 | 49 |
|
43 | 50 | - name: Fail if configuration is old
|
|
0 commit comments