These Terraform scripts create three nodes in Hetzner Cloud, attach a private network to them and create three volumes for each node. Then it creates an Ansible inventory and a script to renew the SSH host entries.
- Clone repository
- Change SSH key name in main.tf (line with ssh_keys)
The key has to exist in the Hetzner Cloud instance - Select OS and TF/OT, for other combinations adjust:
Terraform has to be installed.
terraform init -upgrade
export HCLOUD_TOKEN=<token>
terraform plan -var hcloud_token=$HCLOUD_TOKEN
terraform apply -var hcloud_token=$HCLOUD_TOKEN -auto-approve
- Use the inventory file 'inventory.yaml' with Ansible
terraform destroy -var hcloud_token=$HCLOUD_TOKEN -auto-approve
Within PowerShell
- Install OpenTofu:
winget install OpenTofu.Tofu
tofu init -upgrade
$Env:HCLOUD_TOKEN = "<token>"
tofu plan -var hcloud_token=$Env:HCLOUD_TOKEN
tofu apply -var hcloud_token=$Env:HCLOUD_TOKEN -auto-approve
- Use the inventory file 'inventory.yaml' with Ansible
tofu destroy -var hcloud_token=$Env:HCLOUD_TOKEN -auto-approve
- ansible-galaxy install lablabs.rke2
- ansible-playbook -i inventory.yaml rke2.yml