Date: 2026-05-11
Time: 15:19
This page documents how to provision and manage Hetzner Cloud infrastructure using FTL2, leveraging the hetzner.hcloud Ansible collection. It covers setup, a web stack example, the full module catalog, datacenter locations, and server type naming conventions.
hetzner.hcloud.server), wrapping Ansible collection modules in Python-native async calls..ftl2-state-hetzner.json to record provisioned resources, enabling idempotent re-runs.ftl.add_host() bridges provisioning and configuration — create a server, then SSH into it in the same script.--check) enables dry runs before actual provisioning.Setup:
ansible-galaxy collection install hetzner.hcloud
export HCLOUD_TOKEN="your-api-token"
export HETZNER_SSH_PUBKEY_FILE="~/.ssh/id_ed25519.pub"
Running the web stack example:
uv run python example_hetzner_web_stack.py --check # dry run
uv run python example_hetzner_web_stack.py # provision
uv run python example_hetzner_web_stack.py --teardown # teardown
Python call syntax:
await ftl.hetzner.hcloud.server(name="web01", ...)
Web stack provisions (in order): SSH key → private network + subnet (10.0.0.0/16) → firewall (SSH/HTTP/HTTPS/ICMP) → CX22 server → network attachment → Nginx install via SSH.
HCLOUD_TOKEN injection is an instance of FTL2's secret binding system..ftl2-state-hetzner.json is a concrete example of FTL2 state files for crash recovery and re-entrancy.--check flag is the same global dry-run mechanism used across all FTL2 scripts.add_host() / dynamic hosts — ties into inventory management (adding hosts discovered at runtime)..ftl2-state-hetzner.json — know the naming pattern.cx = shared Intel/AMD, cax = shared ARM/Ampere, cpx = dedicated AMD, ccx = dedicated high-memory AMD.nbg1, fsn1, hel1 (EU), ash (US East), hil (US West), sin (APAC).ansible-galaxy collection install hetzner.hcloud, not pip.ftl.add_host() is how you transition from cloud provisioning to host configuration within a single script.HCLOUD_TOKEN is injected but never logged — a security and audit feature.