AnsibleUndefinedVariable: ‘ansible.vars.hostvars.HostVarsVars object’ has no attribute ‘my_var’

ansible -i inventory all -m debug -a "var=hostvars[inventory_hostname].ansible_host"
ansible -i inventory all -m debug -a "var=hostvars[inventory_hostname].ansible_host" | grep -B1 "NOT DEFINED"

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store