Open FloLaco opened 6 years ago
Yes, you need to use {{ ansible_host }} and not {{ inventory_hostname }}
[cisco]
spine1 ansible_host=10.0.100.101
spine2 ansible_host=10.0.100.102
leaf1 ansible_host=10.0.100.103
leaf2 ansible_host=10.0.100.104
leaf3 ansible_host=10.0.100.105
leaf4 ansible_host=10.0.100.106
inventory_hostname is spine1
, spine2
, et cetera and would need to be DNS resolvable to work in the playbook.
You should follow the last example which doen't use any hostname
parameter.
If you don't provide the hostname
parameter, ansible_host
will be used instead of the inventory hostname if provided in the vars.
Hello guys,
When we follow examples (http://napalm.readthedocs.io/en/latest/tutorials/ansible-napalm.html or https://github.com/napalm-automation/napalm-ansible#examples), the
hostname
is using the{{ inventory_hostname }}
But a classic host file is :
Here's the playbook example :
The playbook does not work
Indeed, the module code set the local params to override provider. (https://github.com/napalm-automation/napalm-ansible/blob/8d868d387f095117c6bb63f828f92a5b84166945/napalm_ansible/modules/napalm_get_facts.py#L192) So my IP is not use but the "name" of the equipment, which is not a dns entry.
Is there some mistake in my inventory file ? Or maybe the example have a mistake and should use
{{ ansible_host }}
instead ?