Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ docker ps | grep zeam_0

## Parallelism (large devnets)

`ansible.cfg` sets **`strategy = free`** and a **`forks`** fallback for bare `ansible-playbook` invocations.
`ansible.cfg` sets **`forks`** as a fallback for bare `ansible-playbook` invocations. **`strategy = free`** is not set globally because it is incompatible with **`add_host`** (used by deploy/stop/clean/copy-genesis). Remote plays that benefit use **`strategy: free`** in the playbook; plays that run **`add_host`** stay on the default **linear** strategy.

**`run-ansible.sh`** and **`ansible-deploy.sh`** pass **`-f N`** where `N` comes from counting **unique `enrFields.ip`** values in the active `validator-config.yaml` (via `ansible/compute-forks-from-validator-config.sh`), clamped between **`LEAN_ANSIBLE_FORKS_MIN`** (default `5`) and **`LEAN_ANSIBLE_FORKS_MAX`** (default `128`). The minimum avoids fully serializing deploys when every validator row shares one IP (many nodes, one machine) while still reflecting larger devnets by unique address.

Expand Down
10 changes: 4 additions & 6 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ display_skipped_hosts = False
display_ok_hosts = True
deprecation_warnings = False

# Large devnets: use strategy=free so hosts do not wait on each other at every task.
# Concurrent sessions: run-ansible.sh / ansible-deploy.sh pass -f from unique
# enrFields.ip in validator-config (see compute-forks-from-validator-config.sh).
# This value applies when ansible-playbook is run without -f and ANSIBLE_FORKS is unset.
# Large devnets: run-ansible.sh / ansible-deploy.sh pass -f from unique enrFields.ip.
# Do not set strategy=free globally — it breaks playbooks that use add_host (deploy-nodes,
# stop-nodes, clean-node-data, copy-genesis). Parallel host execution uses per-play
# strategy: free where safe; default remains linear.
# Override: ANSIBLE_FORKS=50 ansible-playbook ... or ansible-playbook -f 50 ...
# For strict lockstep: ANSIBLE_STRATEGY=linear
forks = 25
strategy = free
# SSH private key file (can be overridden per-host in inventory or via environment variable)
# Defaults to ~/.ssh/id_rsa if not specified
# To use a different key, either:
Expand Down
2 changes: 1 addition & 1 deletion ansible/inventory/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Global variables for all nodes
#
# Parallel runs: ansible/ansible.cfg sets strategy=free and forks=25 as fallback when
# Parallel runs: ansible/ansible.cfg sets forks=25 as fallback when
# no -f is passed. run-ansible.sh and ansible-deploy.sh set -f from unique enrFields.ip
# in validator-config (clamped by LEAN_ANSIBLE_FORKS_MIN / LEAN_ANSIBLE_FORKS_MAX).
# Override forks: ANSIBLE_FORKS=100 or ansible-playbook -f 100 ...
Expand Down
1 change: 1 addition & 0 deletions ansible/playbooks/clean-node-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@

- name: Clean node data directories on remote hosts
hosts: clean_targets
strategy: free
gather_facts: no
vars:
# Use remote paths on remote hosts
Expand Down
2 changes: 2 additions & 0 deletions ansible/playbooks/deploy-nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

- name: Deploy nodes on remote hosts
hosts: deployment_targets
strategy: free
gather_facts: yes
vars:
# Use remote paths on remote hosts
Expand Down Expand Up @@ -248,6 +249,7 @@
# When --replace-with is used, sync updated config yamls to all remote hosts
- name: Sync updated config files to all hosts after replacement
hosts: all:!local
strategy: free
gather_facts: no
vars:
genesis_dir: "{{ remote_genesis_dir | default('/opt/lean-quickstart/genesis') }}"
Expand Down
1 change: 1 addition & 0 deletions ansible/playbooks/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

- name: Prepare remote servers
hosts: all:!localhost
strategy: free
gather_facts: yes
vars:
# network_dir is passed as an extra var by run-ansible.sh; fall back to
Expand Down
4 changes: 2 additions & 2 deletions ansible/playbooks/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# skip_genesis - Set to true to skip genesis generation (default: false)
# genesis_offset - Seconds to add to current time for genesis (default: 360 for ansible mode)
#
# Parallelism: ansible.cfg uses strategy=free; run-ansible / ansible-deploy pass -f from
# unique enrFields.ip in validator-config unless ANSIBLE_FORKS is set.
# Parallelism: remote plays use strategy=free where safe; run-ansible / ansible-deploy pass
# -f from unique enrFields.ip in validator-config unless ANSIBLE_FORKS is set.

- name: Clean Data Directories
import_playbook: clean-node-data.yml
Expand Down
1 change: 1 addition & 0 deletions ansible/playbooks/stop-nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@

- name: Stop nodes on remote hosts
hosts: stop_targets
strategy: free
gather_facts: yes
vars:
node_name: "{{ inventory_hostname }}"
Expand Down
Loading