Ansible, nb_inventory and ansible_host_dns_name - are we missing something? #1391
Unanswered
astekolshchikov
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Do you by chance also have |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello All!
I'm using nb_inventory as dynamic inventory source and fall into somewhat unclear or mis-understanding behavior.
At first i try to explain what we have and what we expect as 'right' behavior.
We widely using ssh jump hosts and ~/.ssh/config rules based on host names. Something like
So, we can easily call #ssh group1-host1 and connection proceeds through jumphost1.
We want ansible to do same - establish connection on hostname basis through jumphosts.
We have hosts in netbox, primary IPs assigned to interfaces.
We have ansible inventory looked up to netbox, and we have in this inventory ansible_host_dns_name set to true.
So, as described in netbox inventory plugin manual, this should be resulted in ansible connects to hosts using dns names.
BUT! Ansible still trying to connect such hosts directly by IP addresses.
The only way we can force ansible to use dns names was making a lot of host_vars inventory files such as /inventory/host_vars/group1-host1.yml containing ansible_host: "{{ dns_name }}"
This totally disappoints us due to we need to create /inventory/host_vars/groupN-hostM.yml for each new host.
Are we missing something?
ansible [core 2.13.13]
ansible-galaxy collection netbox.netbox 3.18.0
NetBox Community v4.2.4
Beta Was this translation helpful? Give feedback.
All reactions