I see that Ansible provide some pre-defined variables that we can use in playbooks and template files. For example, the host ip address is ansible_eth0.ipv4.address. Googlei
Some variables are not available on every host, e.g. ansible_domain
and domain
. If the situation needs to be debugged, I login to the server and issue:
user@server:~$ ansible -m setup localhost | grep domain
[WARNING]: provided hosts list is empty, only localhost is available
"ansible_domain": "prd.example.com",