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
@@ -19,9 +19,12 @@
hosts: all
become: true
gather_facts: false
# steward_token is injected as a per-host inventory var (it differs per host),
# so it must NOT be declared here — a play var would outrank the inventory var
# and shadow it. The globals below arrive as extra-vars (highest precedence),
# which override these defaults.
vars:
steward_url: ""
steward_token: ""
steward_pubkey: ""
steward_user: steward
agent_interval: 30
@@ -29,10 +32,10 @@
- name: Require provisioning vars
ansible.builtin.assert:
that:
- steward_url | length > 0
- steward_token | length > 0
- steward_pubkey | length > 0
fail_msg: "Pass steward_url, steward_token and steward_pubkey as extra-vars."
- steward_url | default('') | length > 0
- steward_token | default('') | length > 0
- steward_pubkey | default('') | length > 0
fail_msg: "Pass steward_url, steward_token and steward_pubkey (Steward injects these)."
# ── Managed login account ────────────────────────────────────────────────
- name: Create the steward management account