fix(host_agent): provision/deploy vars shadowed by play-var precedence
CI / lint (push) Successful in 3s
CI / unit (push) Successful in 8s
CI / integration (push) Successful in 2m15s
CI / publish (push) Successful in 54s

The assertion failed ("Pass steward_url/token/pubkey") because those were
injected as inventory HOST vars, but the playbooks declared them in the play
`vars:` block — and play vars OUTRANK inventory host vars, so the empty
defaults won and the injected values never reached the play.

- Pass globals (steward_url, steward_pubkey, steward_user, agent_interval) as
  extra-vars via the JSON -e @file (highest precedence, space-safe). Keep only
  the per-host steward_token as an inventory host var.
- provision.yml / install.yml: drop steward_token from `vars:` so the host var
  isn't shadowed; assertions use `| default('')` for the un-defaulted token.

This was the next layer under the inventory-format fix — first the inventory
wouldn't parse, now the injected vars actually apply.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 10:11:30 -04:00
parent ad726e65f3
commit 7e6e63521b
3 changed files with 28 additions and 22 deletions
@@ -7,17 +7,18 @@
hosts: all
become: true
gather_facts: false
# steward_token is a per-host inventory var — not declared here, or a play var
# would outrank and shadow it. steward_url arrives as an extra-var.
vars:
steward_url: ""
steward_token: ""
agent_interval: 30
tasks:
- name: Require steward_url and steward_token
ansible.builtin.assert:
that:
- steward_url | length > 0
- steward_token | length > 0
fail_msg: "Pass steward_url and steward_token as extra-vars."
- steward_url | default('') | length > 0
- steward_token | default('') | length > 0
fail_msg: "Pass steward_url and steward_token (Steward injects these)."
- name: Create steward-agent system user
ansible.builtin.user: