Skip to content

fix(ansible): drop hostvars[...].name from start/stop debug msg#396

Open
POPPIN-FUMI wants to merge 1 commit into
mainfrom
fix/ansible-stop-start-debug-hostvars-name
Open

fix(ansible): drop hostvars[...].name from start/stop debug msg#396
POPPIN-FUMI wants to merge 1 commit into
mainfrom
fix/ansible-stop-start-debug-hostvars-name

Conversation

@POPPIN-FUMI
Copy link
Copy Markdown
Contributor

Summary

12 start/stop playbooks under
`template/2026.5.5.1612/ansible/` had a `Display Command output`
debug task that referenced `hostvars[inventory_hostname].name` —
a host variable that is never defined when the playbook is invoked
with a single ad-hoc inventory target (e.g.
`ansible-playbook -i 192.0.2.10, ...`). Ansible raises
`'HostVarsVars' object has no attribute 'name'` at task
finalisation, the playbook exits non-zero, and any orchestration
that treats playbook failure as an abort signal silently skips the
matching `start_*.yml`.

Concrete symptom

A service-restart orchestration ran `stop_solv.yml` on a target.
The Stop Solv shell task succeeded, but the Display Command output
task crashed on the missing `.name`, the playbook exited
non-zero, and the queued follow-up `start_solv.yml` was therefore
aborted. The validator stayed down until an operator noticed and
manually restarted it.

Fix

Match the already-fixed form in
`template/2026.5.5.1612/ansible/mainnet-rpc/start_solv.yml`:

```

  • msg: '{{ inventory_hostname }} ({{ hostvars[inventory_hostname].name }}): : {{ command_output.stdout }}'
  • msg: ': {{ command_output.stdout }}'
    ```

12 files changed, 12 insertions(+), 12 deletions(-). Latest
template only — historical template snapshots are kept as-is.

Test plan

  • `ansible-playbook --syntax-check` clean (= local)
  • Confirmed the unfixed wording was already present in the
    latest template AND in older snapshots, but historical
    snapshots are not touched (= they're frozen artifacts).
  • CI green
  • After merge: operators with an ansible-api host that has
    this template version deployed locally can pull the patched
    copy and re-run a restart orchestration to confirm the chain
    no longer aborts at the debug task.

The `Display Command output` debug task in 12 start/stop playbooks
under `template/2026.5.5.1612/ansible/` referenced
`hostvars[inventory_hostname].name`, a host variable that is never
defined when the playbook is invoked with a single ad-hoc inventory
target (e.g. `ansible-playbook -i 192.0.2.10, ...`).  Ansible raises
`'HostVarsVars' object has no attribute 'name'` at task
finalisation, the playbook exits non-zero, and any orchestration
that treats playbook failure as an abort signal (= the
`queueOrderedSteps` pattern used by the master-api
service-restart routes) silently skips the matching `start_*.yml`
that would have brought the daemon back up.

Concrete symptom that prompted this fix: a `service restart` queue
ran `stop_solv.yml` on a target host, the Stop Solv shell task
succeeded, but the subsequent Display Command output task crashed
on the missing `.name`, the playbook exited non-zero, and the
queued `start_solv.yml` step was therefore aborted.  The validator
stayed down until an operator noticed and restarted it manually.

The same fix was already applied to
`template/2026.5.5.1612/ansible/mainnet-rpc/start_solv.yml`
(= the only playbook with a simple `'Start Solv: …'` debug message
already merged).  This commit brings the other 12 start/stop
playbooks in the latest template into the same form.

Files updated (latest template only — historical templates kept as
shipped):
  ansible/cmn/{start,stop}_solv.yml
  ansible/cmn/{start,stop}_firedancer.yml
  ansible/mainnet-rpc/stop_solv.yml
  ansible/mainnet-rpc/stop_firedancer.yml
  ansible/mainnet-validator/{start,stop}_solv.yml
  ansible/mainnet-validator/stop_firedancer.yml
  ansible/testnet-validator/{start,stop}_solv.yml
  ansible/testnet-validator/stop_firedancer.yml

Each change is a single-line replacement:

  before: msg: '{{ inventory_hostname }} ({{ hostvars[inventory_hostname].name }}): <Action>: {{ command_output.stdout }}'
  after:  msg: '<Action>: {{ command_output.stdout }}'

No behaviour change to the actual systemctl invocation in the
previous task, so already-working `start_*.yml` paths (mainnet-rpc
in particular) are unaffected.
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.

1 participant