Skip to content

ansible: parallelize large devnet deploys - #173

Merged
g11tech merged 4 commits into
mainfrom
feature/ansible-parallel-deploy-pr
May 13, 2026
Merged

g11tech merged 4 commits into
mainfrom
feature/ansible-parallel-deploy-pr

Conversation

@ch4r10t33r

@ch4r10t33r ch4r10t33r commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Faster / more parallel Ansible

  • Set strategy = free and a higher default forks in ansible/ansible.cfg so hosts are not limited to Ansible’s stock forks=5 / linear lockstep when ansible-playbook is run without wrappers.
  • run-ansible.sh and ansible-deploy.sh pass -f derived from the count of unique enrFields.ip values in the active validator-config.yaml (via ansible/compute-forks-from-validator-config.sh), clamped by LEAN_ANSIBLE_FORKS_MIN (default 5) and LEAN_ANSIBLE_FORKS_MAX (default 128). ANSIBLE_FORKS still overrides.
  • Documented tuning in ansible/README.md, group_vars/all.yml, and site.yml comments.

copy-genesis: libp2p keys only where needed

  • copy-genesis.yml now copies *.key only for validators collocated on the host (enrFields.ip == ansible_host), not every node’s private key to every server. Peers verify using public genesis metadata (validators.yaml, genesis.ssz, ENRs, etc.); other nodes’ private .key files are not required cluster-wide.
  • If no validator row matches the host IP, the play falls back to [inventory_hostname] so single-node layouts still work.
  • Pre-flight still requires every *.key to exist in the local genesis directory before any remote copy.
  • ansible/README.md: clarified what appears on remotes vs local genesis.

Rationale

  • Forks: Ansible cannot set forks from inventory at runtime; wrappers compute -f before startup. Unique IP count approximates distinct machines; the minimum avoids -f 1 when many validators share one IP.
  • Keys: Reduces data moved over SSH, disk on each host, and blast radius; behavior aligns with deploy-nodes.yml (per-node sync) and prepare.yml (grouping by IP).

How to test

  • bash -n run-ansible.sh ansible-deploy.sh ansible/compute-forks-from-validator-config.sh
  • ansible-playbook --syntax-check on site.yml / copy-genesis.yml / deploy-nodes.yml / prepare.yml
  • Optional: ./ansible/compute-forks-from-validator-config.sh ansible-devnet/genesis/validator-config.yaml and confirm printed forks match expectations.
  • After copy-genesis, on a multi-IP devnet, spot-check two remotes: each should have all shared genesis files but only *.key files for validators on that IP (plus existing per-node hash-sig behavior).

Raise concurrent SSH sessions above Ansible's default of five and use
the free execution strategy so hosts do not block each other at every task.
Document overrides (ANSIBLE_FORKS, -f, ANSIBLE_STRATEGY) in ansible README,
group_vars, site.yml, and ansible.cfg comments.
Ansible cannot choose forks from YAML at runtime; run-ansible.sh and
ansible-deploy.sh now pass -f from unique enrFields.ip (with min/max
clamps via LEAN_ANSIBLE_FORKS_*). ANSIBLE_FORKS still overrides.
Add ansible/compute-forks-from-validator-config.sh and document
LEAN_VALIDATOR_CONFIG_PATH for ansible-deploy.
@ch4r10t33r
ch4r10t33r requested a review from g11tech May 13, 2026 16:39
Peers verify using public genesis metadata, not other nodes' private keys.
Copy *.key files whose enrFields.ip matches ansible_host; fall back to
inventory_hostname. Document remote layout in ansible README.
- generate-genesis: hash-sig-cli --export-format ssz; detect existing keys via .ssz
- parse-vc: HASH_SIG_* paths point at .ssz files
- ansible copy/deploy: stop copying *_pk.json / *_sk.json
- README: document SSZ key layout and troubleshooting
@g11tech
g11tech merged commit 9e739f5 into main May 13, 2026
4 checks passed
@g11tech
g11tech deleted the feature/ansible-parallel-deploy-pr branch May 13, 2026 17:39
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