Interview Prep/Ansible/Variables, Facts and Precedence Problems

`set_fact: release_tag=v2` runs, but later tasks still see `v1`

IntermediateTroubleshootingVariables, Facts and Precedence Problems
Answer

Likely causes → release_tag was also passed with -e (or comes from an AWX survey or extra vars). Extra vars have the highest precedence and override set_fact, register and everything else.

Diagnose → Check the job command line and the AWX extra vars or survey. debug: var=release_tag straight after the set_fact still shows v1.

Fix → Use a different name for the computed value (release_tag_effective), or stop passing the key as an extra var.

Prevent → Reserve extra vars for true run-time inputs, and never reuse those names for internal facts.

All Ansible questions Roadmap: Ansible

More on Variables, Facts and Precedence Problems