perf(ansible): faster, retry-safe deployments and readable tests #42

Merged
mixel merged 3 commits from hermes/ansible-performance-20261011 into main 2026-10-11 18:17:40 +00:00 AGit
Contributor

Changes

  • Reinstall only changed/new plugins; core upgrades still reinstall all requested plugins.
  • Avoid duplicate Camofox/Hindsight starts, retaining environment changes and enablement-only restart paths.
  • Compute dependency metadata/hash in one Node process instead of two.
  • Invalidate dependency stamps before repair so failed partial installs are retried correctly.
  • Skip activation of a not-yet-created Gateway unit during fresh-host check mode.
  • Keep the unconditional systemd reload for safe recovery after interrupted deployment.

Readable test fixtures

No new Python deployment script is introduced. Plugin integration tests use a static Ansible playbook and a four-line shell CLI fixture instead of generating a nested Python script and playbook. Dependency checks now run directly in Bash; the dedicated Python dependency-test file has been removed. Remaining Python files are integration-test runners only.

Validation

24 unittest tests passed, plus 7 native Bash dependency checks. Includes real Ansible plugin tasks against offline fixtures, 14 restart-policy scenarios and a fresh-host dry-run test. Scoped Ansible syntax-check, shell syntax-check and git diff --check passed.

python -m unittest discover -s ansible/roles/services/openclaw/tests -v
bash ansible/roles/services/openclaw/tests/test_runtime_dependencies.sh

Single-spec changes reduce plugin installation operations from five to one for current host specs. Whole-deployment speedup is not benchmarked. No full host check-mode playbook or live lifecycle/deployment test was run.

Scope

Verified main baseline 2f1f4dc. Shared dirty checkout and running services untouched. Review only, not merged/deployed.

Site playbook performance

  • Enable SSH pipelining, leaving existing SSH multiplexing defaults unchanged. Hosts requiring sudo TTY can disable ansible_ssh_pipelining; no live SSH compatibility test performed.
  • Use smart gathering with an in-memory cache, collecting facts once per host per invocation, not retaining stale facts across runs.
  • Normal convergence no longer performs an OS distribution upgrade. The existing task ansible:update SERVICE=<host> / --tags update path retains explicit maintenance. Required package installation remains unchanged.
  • Preserve play ordering, handler behavior, run_once loading and Pi-hole serial rollout.
  • Document behavior and overrides in docs/ANSIBLE_DEPLOYMENT.md.

Native Ansible task-list checks verified normal/update selection; an actual two-play localhost run gathered facts once and both plays accessed them; connection-plugin configuration confirms pipelining=true. No host apply or full-deployment timing benchmark performed.

## Changes - Reinstall only changed/new plugins; core upgrades still reinstall all requested plugins. - Avoid duplicate Camofox/Hindsight starts, retaining environment changes and enablement-only restart paths. - Compute dependency metadata/hash in one Node process instead of two. - Invalidate dependency stamps before repair so failed partial installs are retried correctly. - Skip activation of a not-yet-created Gateway unit during fresh-host check mode. - Keep the unconditional systemd reload for safe recovery after interrupted deployment. ## Readable test fixtures No new Python deployment script is introduced. Plugin integration tests use a static Ansible playbook and a four-line shell CLI fixture instead of generating a nested Python script and playbook. Dependency checks now run directly in Bash; the dedicated Python dependency-test file has been removed. Remaining Python files are integration-test runners only. ## Validation 24 unittest tests passed, plus 7 native Bash dependency checks. Includes real Ansible plugin tasks against offline fixtures, 14 restart-policy scenarios and a fresh-host dry-run test. Scoped Ansible syntax-check, shell syntax-check and git diff --check passed. ```bash python -m unittest discover -s ansible/roles/services/openclaw/tests -v bash ansible/roles/services/openclaw/tests/test_runtime_dependencies.sh ``` Single-spec changes reduce plugin installation operations from five to one for current host specs. Whole-deployment speedup is not benchmarked. No full host check-mode playbook or live lifecycle/deployment test was run. ## Scope Verified main baseline 2f1f4dc. Shared dirty checkout and running services untouched. Review only, not merged/deployed. ## Site playbook performance - Enable SSH pipelining, leaving existing SSH multiplexing defaults unchanged. Hosts requiring sudo TTY can disable `ansible_ssh_pipelining`; no live SSH compatibility test performed. - Use smart gathering with an in-memory cache, collecting facts once per host per invocation, not retaining stale facts across runs. - Normal convergence no longer performs an OS distribution upgrade. The existing `task ansible:update SERVICE=<host>` / `--tags update` path retains explicit maintenance. Required package installation remains unchanged. - Preserve play ordering, handler behavior, run_once loading and Pi-hole serial rollout. - Document behavior and overrides in docs/ANSIBLE_DEPLOYMENT.md. Native Ansible task-list checks verified normal/update selection; an actual two-play localhost run gathered facts once and both plays accessed them; connection-plugin configuration confirms pipelining=true. No host apply or full-deployment timing benchmark performed.
hermes changed title from fix(openclaw): make Ansible deploys faster and retry-safe to fix(openclaw): faster and retry-safe Ansible deploys 2026-10-10 23:52:36 +00:00
hermes changed title from fix(openclaw): faster and retry-safe Ansible deploys to perf(ansible): faster, retry-safe deployments and readable tests 2026-10-11 00:07:29 +00:00
mixel merged commit 7c9193e6b5 into main 2026-10-11 18:17:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mixel/infrastructure!42
No description provided.