how to use ansible built-in variables
shaoqin178 opened this issue · comments
When I use the built-in variables ansible_ssh_host
, I got this error.
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleUndefinedVariable: 'ansible_ssh_host' is undefined. 'ansible_ssh_host' is undefined
I am unsure if I am missing something but to my knowledge, there is no ssh-specific host variable (see https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html). To access the hostname I usually use ansible_host
or ansible_fqdn