Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions ansible/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,37 @@
# below produced by dev/setup-env.sh - gives empty list if file is missing:
_requirements_installed: "{{ ((lookup('file', _requirements_path + '.last', errors='ignore') or '{}') | from_yaml ).values() | flatten }}"

- name: Validate OpenTofu templated inventory is appropriate
# This "documents" the assumptions that Ansible makes about the
# OpenTofu-provided inventory
hosts: localhost
gather_facts: false
tags:
- validate
- opentofu
tasks:
- name: Check templated groups
assert:
that:
- item in groups
- groups[item] | length > 0
fail_msg: >
Expected inventory group '{{ item }}' is missing or empty:
- Check OpenTofu inventory template is up to date
- Check OpenTofu configuration defines 'login' and 'compute' variables properly
loop:
- control
- compute
- login
- name: Check templated 'all' vars
assert:
that:
- openhpc_cluster_name is defined
- cluster_domain_suffix is defined
- cluster_home_volume is defined
- cluster_compute_groups is defined
fail_msg: "One or more expected variables are missing: is OpenTofu inventory template up to date?"

- name: Ensure control node is in inventory
hosts: all
gather_facts: false
Expand Down