Skip to content

Commit 4fd6ccf

Browse files
committed
add validation for non-overlapping nodegroups
1 parent 04f3bbb commit 4fd6ccf

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

tasks/runtime.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
- include_tasks: pre.yml
44

5-
- name: Check openhpc_slurm_control_host, openhpc_cluster_name or openhpc_slurm_partitions exist
6-
assert:
7-
that:
8-
- openhpc_slurm_control_host is defined
9-
- openhpc_cluster_name is defined
10-
- openhpc_cluster_name != ''
11-
- openhpc_slurm_partitions is defined
12-
fail_msg: "Undefined openhpc_slurm_control_host, openhpc_cluster_name or openhpc_slurm_partitions."
13-
145
- name: Fail if control host not in play and munge key not specified
156
fail:
167
msg: "Either the slurm control node must be in the play or `openhpc_munge_key` must be set"

tasks/validate.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- name: Check openhpc_slurm_control_host and openhpc_cluster_name
2+
assert:
3+
that:
4+
- openhpc_slurm_control_host is defined
5+
- openhpc_slurm_control_host != ''
6+
- openhpc_cluster_name is defined
7+
- openhpc_cluster_name != ''
8+
fail_msg: openhpc role variables not correctly defined, see detail above
9+
10+
- name: Check no host appears in more than one nodegroup
11+
assert:
12+
that: "{{ _openhpc_check_hosts.values() | select('greaterthan', 1) | length == 0}}"
13+
fail_msg: |
14+
Some hosts appear more than once in inventory groups {{ _openhpc_node_inventory_groups | join(', ') }}:
15+
{{ _openhpc_check_hosts | dict2items | rejectattr('value', 'equalto', 1) | items2dict | to_nice_yaml }}
16+
vars:
17+
_openhpc_node_inventory_groups: "{{ openhpc_nodegroups | map(attribute='name') | map('regex_replace', '^', openhpc_cluster_name ~ '_') }}"
18+
_openhpc_check_hosts: "{{ _openhpc_node_inventory_groups | map('extract', groups) | flatten | community.general.counter }}"

0 commit comments

Comments
 (0)