I am learning Ansible and I am observe that the variable (fact) naming seems to be inconsistent.
For example, my Jinja2 template can run successfully.
{% for host in groups['node'] %}
{{ hostvars[host]['ansible_facts']['default_ipv4']['address'] }}
{% endfor %}
But if I run ad-hoc command setup
to show all variables, the variable name will be ansible_default_ipv4
. If I input the prefix ansible_
in playbooks, it then not run.
I ran then setup
module to look for the variable name I need and I am so confuse about it now.
Am I doing it wrong, or have another proper way to look for variable name?
I tried looking for answer anywhere.
Thank you.