The tenant playbook ran from the control plane, one SSH round trip per task, for work that touches nothing but the head node. The template now carries the automation, and Terraform hands each clone only its own inventory as cloud-init vendor data; a first-boot unit runs the same roles locally. The control plane drives Terraform and then watches a status file instead of driving the provision itself - which is also what makes this work unchanged against a provider that is not Proxmox. Vendor data, not user data. Proxmox generates the user data that creates the login account and installs its keys, and supplying our own would replace that wholesale and lock the tenant out of its own head node. Two things this surfaced, both invisible while the playbook ran over SSH. systemd starts services with no HOME, and wwctl refuses to run without one - a login shell had been supplying it. And the collections were installed unpinned, which made the template a moving target; the install already warned that current ansible.utils does not support the ansible-core Rocky 9 ships. They are pinned to versions that do. Node names, MACs and addresses were computed in four places - the VM resource, two outputs, and now the inventory. They are computed once and read from there. A MAC derived twice is exactly how a node ends up PXE booting and never being recognised. Measured, cold, destroy to a cluster running jobs on both nodes: terraform 30s, self-configuration 82s, node PXE and Slurm 82s, total 194s against 215s. Less than the earlier estimate of ~60s off the configure phase, and worth being precise about why: that estimate came from timing a local run against an already-provisioned host, where most tasks were no-ops. Cold against cold it is 100s remote to 78s local. The rest of what the first-boot unit spends is waiting for cloud-init to finish, which the old flow did not pay because it only waited for sshd.
23 lines
887 B
Desktop File
23 lines
887 B
Desktop File
[Unit]
|
|
Description=Configure this HPC head node from its cloud-init inventory
|
|
# cloud-init writes the inventory this reads, so it must finish first.
|
|
After=cloud-final.service network-online.target
|
|
Wants=network-online.target
|
|
ConditionPathExists=/etc/hpcod/inventory.yml
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
# systemd starts services with no HOME. wwctl reads it and refuses to run
|
|
# without one ("could not obtain the user's home directory"), which never
|
|
# showed while the playbook ran over SSH because a login shell had already
|
|
# set it. Anything else that quietly assumes a home directory is covered too.
|
|
Environment=HOME=/root
|
|
ExecStart=/usr/local/sbin/hpcod-firstboot
|
|
RemainAfterExit=yes
|
|
# The provision installs packages and compresses a ~1 GB image; the default
|
|
# timeout would kill it partway and leave a cluster nobody can explain.
|
|
TimeoutStartSec=1800
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|