Determine which Ansible variable source wins based on precedence order rules.
Ansible resolves the same variable name defined in multiple places using a strict, well-documented 22-level precedence order, from role defaults (lowest) to extra vars passed with -e on the command line (highest, always wins). This calculator looks up two variable sources and reports which one wins based on their rank in that order — higher rank always overrides lower rank regardless of where the variable 'looks' like it should apply.
winner = source with max(rank_A, rank_B) in Ansible's 22-level precedence order
Extra vars passed via `-e` on the `ansible-playbook` command line (level 22) always have the highest precedence and cannot be overridden by any other source, including task vars.
Role defaults are designed to be easily overridden — they exist to provide sane fallback values, not to enforce behavior, so nearly every other variable source can override them.
Yes — task vars (level 17) are more specific in scope than role vars (level 15) and win, which follows Ansible's general principle that more specific/local scope beats broader/less specific scope.
The Ansible documentation's 'Understanding variable precedence' page lists the canonical 22-level order this calculator implements verbatim.