Back to Hub

cargo.ayedo.cloud/ayedo/hcloud/infrastructure 0.1.3 generic

Inventory-driven Hetzner Cloud provisioning: creates network/firewall/placement-group/SSH key and one VM per host defined in workspace inventory.yml. Patches inventory.yml for the k8s block contract (ansible_host, public_ip, internal_ip, all.vars.primary_ip). Does not use the hcloud dynamic inventory plugin. Optional cloud-init SSH bootstrap (sysops + port 4422) aligns with the linux/hardening block. Network/firewall/SSH key names are overridable; manage: false reuses existing Hetzner resources.

polycrate block pull cargo.ayedo.cloud/ayedo/hcloud/infrastructure:0.1.3

cargo.ayedo.cloud/ayedo/hcloud/infrastructure

Inventory-driven Hetzner Cloud provisioning. After create, patches ansible_host, IPs and (optionally) ansible_user / ansible_ssh_port into workspace inventory.yml. Does not use the hcloud dynamic inventory plugin.

Actions

Action Description
install SSH key → PG → network → firewall → VMs → patch inventory → wait for SSH
ensure-ssh-key Create/update the Hetzner project SSH key from artifacts/secrets/id_rsa.pub
uninstall Delete VMs; delete only managed network/firewall/PG/SSH key
patch-inventory Refresh IPs (+ SSH connection vars) from Hetzner into inventory.yml
show-plan Print resolved plan (no writes)
polycrate run infrastructure show-plan
polycrate run infrastructure ensure-ssh-key   # optional standalone
polycrate run infrastructure install
polycrate run hardening install               # optional, idempotent
polycrate run k8s install

SSH bootstrap (sysops / 4422)

Default aligns with cargo.ayedo.cloud/ayedo/linux/hardening:

ssh:
  manage: true
  bootstrap_enabled: true
  bootstrap_user: sysops
  port: 4422
  wait: true
  wait_timeout: 300
  public_key_file: artifacts/secrets/id_rsa.pub

On first VM create, cloud-init:

  • creates sysops with sudo + authorized key
  • sets sshd to port 4422, PermitRootLogin no
  • install waits until that port accepts connections

user_data is applied by Hetzner only at create time. Existing servers are not re-bootstrapped unless rebuilt.

Override with raw defaults.user_data if needed (wins over generated bootstrap).

Network / firewall / SSH key reuse

Field Meaning
*.enabled Attach resource to VMs
*.manage true = create/update/delete; false = reuse existing by name
*.name Hetzner resource name (empty → workspace.name)
network:
  enabled: true
  manage: false
  name: customer-prod-net
firewall:
  enabled: true
  manage: false
  name: customer-prod-fw
ssh:
  manage: false
  key_name: customer-shared-key

ensure-ssh-key always pushes the local public key (forces manage for that action).

Inventory (k8s contract)

Aligned with cargo.ayedo.cloud/ayedo/linux/k8s-* inventory mode (cluster_ip_detection.enabled: false):

Field Where Meaning
ansible_host host SSH target from Polycrate (public | private)
public_ip / public_interface host / all.vars Node external IP / NIC
internal_ip / internal_interface host / all.vars Private cluster plane (also written as private_ip)
primary_ip / primary_interface all.vars API/join endpoint for peers + workers

primary_ip resolution (inventory.manage_primary_ip: true):

  1. inventory.primary_ip — explicit override (VIP / managed / external CP)
  2. inventory.primary_host — use that host's internal_ip
  3. else: internal_ip of the first host in inventory.controlplane_group
inventory:
  controlplane_group: k8s_controlplane
  manage_primary_ip: true
  # primary_ip: "10.11.3.99"   # managed/external API
  # primary_host: festo-controlplane-1
  internal_interface: enp7s0
  public_interface: eth0
  primary_interface: enp7s0

Hosts live in inventory.yml (source of truth). The block also patches:

  • ansible_user / ansible_ssh_port when inventory.patch_ssh_connection and bootstrap enabled

Per-host overrides: hcloud_server_type, hcloud_image, hcloud_location, hcloud_enable_ipv4, hcloud_enable_ipv6, hcloud_labels.