`nginx_worker_processes` is `8` on one host, and nobody knows where it is set
IntermediateTroubleshootingVariables, Facts and Precedence Problems
Answer
Likely causes → It is defined in one of more than 20 precedence layers: a role default, a role var, group_vars, host_vars, inventory, set_fact, include_vars, or extra vars.
Diagnose →
ansible-inventory -i inventories/prod --host web07 --vars | jq .nginx_worker_processes
grep -rn 'nginx_worker_processes' inventories/ roles/ playbooks/
ansible -i inventories/prod web07 -m ansible.builtin.debug -a var=nginx_worker_processes
If inventory does not have it, check set_fact, include_vars and the AWX extra vars and surveys.
Fix → Remove the stray definition, and keep the variable in one intended layer.
Prevent → Prefix role variables with the role name, keep overrides in group_vars only, and check for duplicate definitions in code review.
More on Variables, Facts and Precedence Problems
Variables in `group_vars/webservers.yml` are silently ignoredBeginnerYou set `nginx_port: 8443` in inventory `group_vars`, but the role still uses `80`Intermediate`set_fact: release_tag=v2` runs, but later tasks still see `v1`Intermediate`'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'` when templating `hostvars['db01']`Intermediate`'ansible_eth0' is undefined` on new cloud instancesBeginnerFacts like `ansible_hostname` became undefined after someone changed `ansible.cfg`Intermediate