Skip to content

Commit 0be53fc

Browse files
committed
Merge remote-tracking branch 'origin/main' into ci/enable-linting
2 parents 68f7277 + 919a7e2 commit 0be53fc

File tree

2 files changed

+179
-148
lines changed

2 files changed

+179
-148
lines changed

ansible/validate.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,37 @@
4747
# below produced by dev/setup-env.sh - gives empty list if file is missing:
4848
_requirements_installed: "{{ ((lookup('file', _requirements_path + '.last', errors='ignore') or '{}') | from_yaml ).values() | flatten }}"
4949

50+
- name: Validate OpenTofu templated inventory is appropriate
51+
# This "documents" the assumptions that Ansible makes about the
52+
# OpenTofu-provided inventory
53+
hosts: localhost
54+
gather_facts: false
55+
tags:
56+
- validate
57+
- opentofu
58+
tasks:
59+
- name: Check templated groups
60+
ansible.builtin.assert:
61+
that:
62+
- item in groups
63+
- groups[item] | length > 0
64+
fail_msg: >
65+
Expected inventory group '{{ item }}' is missing or empty:
66+
- Check OpenTofu inventory template is up to date
67+
- Check OpenTofu configuration defines 'login' and 'compute' variables properly
68+
loop:
69+
- control
70+
- compute
71+
- login
72+
- name: Check templated 'all' vars
73+
ansible.builtin.assert:
74+
that:
75+
- openhpc_cluster_name is defined
76+
- cluster_domain_suffix is defined
77+
- cluster_home_volume is defined
78+
- cluster_compute_groups is defined
79+
fail_msg: "One or more expected variables are missing: is OpenTofu inventory template up to date?"
80+
5081
- name: Ensure control node is in inventory
5182
hosts: all
5283
gather_facts: false

0 commit comments

Comments
 (0)