How do you check the value a variable resolves to on a specific host?
IntermediateProductionRapid-Fire Commands
Answer
ansible web01 -i inventories/prod -m ansible.builtin.debug -a "var=ntp_servers"
ansible web01 -i inventories/prod -m ansible.builtin.debug -a "msg={{ hostvars[inventory_hostname] | to_nice_json }}"
This shows inventory, group_vars and host_vars values. It does not include role defaults or play vars, so for those add a temporary debug task in the play itself.
More on Rapid-Fire Commands
How do you see which hosts a playbook would run against, without running it?BeginnerHow do you list the tasks and tags a playbook contains?BeginnerHow do you inspect the inventory structure and a host's variables?BeginnerHow do you restart a service on a group with an ad-hoc command?BeginnerHow do you resume a playbook from a specific task or step through it?BeginnerHow do you re-run a playbook only on the hosts that failed?Intermediate