Skip to content

playbook: deploy tysm canary configs from templates - #183

Open
parithosh wants to merge 2 commits into
masterfrom
parithosh/tysm-config-deploy
Open

playbook: deploy tysm canary configs from templates#183
parithosh wants to merge 2 commits into
masterfrom
parithosh/tysm-config-deploy

Conversation

@parithosh

@parithosh parithosh commented Aug 3, 2026

Copy link
Copy Markdown
Member

Split out of #180 per review feedback (it mixed concerns with the backport batch).

What

On glamsterdam-devnet-7 the tysm beacon canary's hook + xatu config files were hand-copied into the prysm datadir — the prysm role has no file-push task (ethpandaops/glamsterdam-devnets@25695b9 notes this) — so every new canary host crash-looped on missing files until someone ran an ad-hoc copy.

This backports the generic mechanism, driven by a dedicated tysm inventory group (empty by default in the template):

  • terraform nodes.tf — node entries take an optional tysm = true flag. It propagates as a tysm:<network> tag (DigitalOcean) / label (Hetzner) on the instances, mirroring how supernode and builder_index flow today.
  • ansible_inventory.tmpl / outputs.tf — the tag surfaces as a per-host attribute and renders a [tysm] group in the generated inventory. The group header is always emitted so the playbook play resolves; it's just empty until a node opts in.
  • firewall.tf — new tysm firewalls (DO + Hetzner) open the 8675 control API port (bad-tysm dials back on it) scoped to tagged instances only, unlike the fleet-wide rule on glamsterdam. Created only when at least one tysm node exists.
  • inventories/devnet-0/templates/tysm/*.j2 — hook + xatu configs templatized on existing vars: inventory_hostname (instance/pod/node names), ansible_host (the self_url IP bad-tysm dials back to), ethereum_node_cl/ethereum_node_el (labels), ethereum_network_name (namespace). ${TYSM_TOKEN} placeholders resolve from container env at load, not from Ansible.
  • New play in playbook.yaml — targets hosts: tysm (no more tysm_enabled host_vars flag), placed before the ethereum_node role play so the files exist before first container boot. Creates the prysm user/datadir mirroring the role's ownership and renders both files into the datadir, which the existing mount surfaces at /data in the container. Tagged [ethereum, ethereum_node, tysm].

The group is empty in the template, so forks see no behavior change unless a node entry opts in via tysm = true. Live equivalent: ethpandaops/glamsterdam-devnets#58.

Verification

  • terraform validate passes and terraform fmt --recursive --check (the CI lint) is clean.
  • Rendered ansible_inventory.tmpl via templatefile() with mock hosts (one tysm-tagged, two not): [tysm] contains exactly the tagged host; with no tagged hosts the group renders empty but present.
  • ansible-playbook --list-tasks against that rendered inventory: the tysm play targets the tysm group with the three deploy tasks, ordered before the ethereum_node role play, matching under -t ethereum, -t ethereum_node and -t tysm.
  • Exact CI lint invocation (ansible-lint --profile production + the workflow skip-list): no new violations. The 4 failures CI reports at the "Refresh inventory web" play are pre-existing on master (#noqa vs # noqa: syntax) and are fixed by backport generic improvements from glamsterdam-devnets and bal-devnets #180 — this PR goes green once that merges.

🤖 Generated with Claude Code

The tysm beacon canary on glamsterdam-devnet-7 had its hook + xatu
config files hand-copied into the prysm datadir because no play pushed
them, so every new canary host crash-looped on missing files until
someone ran an ad-hoc copy.

Backport the fix: jinja2 templates keyed on inventory_hostname,
ansible_host and the ethereum_node_cl/el vars, rendered into the prysm
datadir by a tysm_enabled-gated play that runs before the ethereum_node
role starts the container. The flag defaults to false, so nothing
changes unless a host opts in via host_vars.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread ansible/playbook.yaml Outdated
Replace the tysm_enabled host_vars flag with a tysm group wired through
the stack: a per-node "tysm = true" flag in nodes.tf propagates as a
tysm:<network> tag/label, the inventory template renders a [tysm] group
from it (always present, empty by default), and a group-scoped firewall
opens the 8675 control port on just those instances. The playbook play
now targets hosts: tysm instead of gating on the var, so membership
lives in one place — the terraform node definition.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants