Skip to content

Commit d16b6ba

Browse files
committed
add validation
1 parent ea7902a commit d16b6ba

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

tasks/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
---
22

3+
- name: Validate configuration
4+
block:
5+
- include_tasks: validate
6+
when: openhpc_enable.runtime | default(false) | bool
7+
tags: install
8+
39
- name: Install packages
410
block:
511
- include_tasks: install.yml

tasks/validate.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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 }}"
19+
20+
- name: Fail if configuration is old
21+
assert:
22+
that: openhpc_slurm_partitions is not defined
23+
fail_msg: stackhpc.openhpc parameter openhpc_slurm_partitions has been replaced - see openhpc_nodegroups and openhpc_partitions

0 commit comments

Comments
 (0)