Files
ilkerandClaude Opus 5.5 772579648c hpcod: one binary installs, checks and tests the control plane
An installation used to be this one: the deploy scripts and the Ansible
defaults carried one site's domain, hypervisor and login, the Proxmox side
and the database were set up by hand, and deploying meant copying scripts
and a tree of roles beside the binary and keeping them in step with it.

The binary now carries the roles, the Terraform module, the schema and the
catalogue (embed.go), and installs itself:

- hpcod setup: a full-screen installer for administrators. It asks where
  clusters are built, signs in to Proxmox before asking anything else
  (root's password once, or tokens), offers nodes and datastores from what
  Proxmox has, checks every field as it is typed, runs every step with its
  output live, checks the result and offers a test cluster. -yes runs the
  same steps from a site file; make deploy uses that.
- hpcod verify: each fact checked by using it.
- hpcod selftest: the smallest real cluster, by the portal's own path, a
  job run on it, then taken down.
- Closed networks: hpcod serves HTTPS itself from a CA name-constrained to
  the site's domains, issuing and renewing its own certificate, and
  answers DNS for the portal and every cluster name.
- A simulated Proxmox: Proxmox VE in QEMU on the control plane host, on a
  private bridge with NAT, for trying it without one.

Every step reads back what it changed and is safe to run again. The
site's values live in one file; group_vars/all/site.yml is generated from
it, and the playbooks refuse to run without it. ci_user and -ssh-user no
longer default to a personal account. scripts/B10, B20 and C20 are gone:
their work is the setup steps.

Proven end to end on a simulated Proxmox (Proxmox VE 9 in a VM on a real
host): the install, the Proxmox step by the password path, the head
template, verify READY, and a test cluster that ran srun on its compute
node and was destroyed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 18:20:04 +01:00

123 lines
4.3 KiB
YAML

---
# Configure one tenant HPC cluster on the head node Terraform created.
#
# Order matters and is not arbitrary:
# common - hostname, packages, firewall, forwarding
# warewulf - install, point at the tenant subnet, start provisioning
# node_image - the rootfs the compute nodes will boot
# slurm - OpenHPC, MUNGE, the hpc overlay carrying config to nodes
# warewulf_nodes- register the MAC/IP pairs and build overlays
#
# slurm runs before warewulf_nodes because the overlay it creates has to exist
# before the final overlay build, otherwise the nodes boot without slurm.conf
# or the MUNGE key and come up unable to join the cluster.
- name: Provision the tenant head node
hosts: head
become: true
# Facts are gathered after the wait below, not before it: gathering opens a
# connection, and at this point in a provision there may not be one yet.
gather_facts: false
pre_tasks:
# Terraform returns as soon as Proxmox has started the VM, but cloud-init
# has not yet written the authorised keys, so the first connection is
# refused. Without this gate the playbook fails with a bare "Permission
# denied" that reads like a wrong key rather than a race.
- name: Wait for the head node to accept SSH
ansible.builtin.wait_for_connection:
timeout: 300
sleep: 5
- name: Gather facts
ansible.builtin.setup:
- name: Fail early if the inventory is missing the tenant's fabric
ansible.builtin.assert:
that:
- compute_nodes is defined
- compute_nodes | length > 0
- cluster_id is defined
- cluster_cidr is defined
- head_cluster_ip is defined
- dhcp_range_start is defined
- dhcp_range_end is defined
fail_msg: >-
The inventory must supply the tenant's own addresses and node list.
These have no defaults on purpose: a default would override the
inventory rather than fall back to it. compute_nodes in particular
must come from the Terraform output, because Warewulf matches nodes
by MAC - a guessed one produces a cluster that never boots.
- name: Fail early if the site's own values are missing
ansible.builtin.assert:
that:
- node_image_uri | default('') | length > 0
- registry_host | default('') | length > 0
- ondemand_public_domain | default('') | length > 0
- ondemand_desktop_image | default('') | length > 0
fail_msg: >-
group_vars/all/site.yml is missing or incomplete. It is generated
from the site by `hpcod setup`; without it the
portal would be published under no domain and the nodes would have
no image to boot.
# Tagged so one part can be re-run on its own. Re-running everything to
# change the portal would rebuild the node image too - four minutes and
# a risk taken for nothing.
roles:
- { role: common, tags: [common] }
- { role: warewulf, tags: [warewulf] }
- { role: node_image, tags: [node_image] }
tasks:
- name: Slurm and OpenHPC
ansible.builtin.include_role:
name: slurm
apply:
tags: [slurm]
tags: [slurm]
- name: Register the compute nodes
ansible.builtin.include_role:
name: warewulf_nodes
apply:
tags: [nodes]
tags: [nodes]
# After the scheduler exists, because the portal's cluster definition
# discovers the Slurm binaries and asks slurmctld what it is called.
# Before the portal, so a user who logs in finds the software already
# there rather than arriving during their first session.
- name: Application images
ansible.builtin.include_role:
name: apps
apply:
tags: [apps]
tags: [apps]
- name: User-facing portal
ansible.builtin.include_role:
name: ondemand
apply:
tags: [ondemand]
tags: [ondemand]
- name: Verify the head node
ansible.builtin.include_role:
name: verify
apply:
tags: [verify]
tags: [verify]
- name: Verify the whole cluster once the nodes are up
hosts: head
become: true
gather_facts: false
tags: [cluster, never]
tasks:
- name: Cluster checks
ansible.builtin.include_role:
name: verify
tasks_from: cluster