Netbox intergation with Ansible AWX #11916
Replies: 4 comments 3 replies
-
I think you should set the loopback address as the "primary IP" for each device or VM in Netbox. Is that not visible to Ansible? |
Beta Was this translation helpful? Give feedback.
-
@candlerb is correct about the primary IP. Your other option is to use dns if you have fqdns set for each device the You can do this a number of ways: 1.) Using ---
ansible_host: "{{ inventory_hostname }}.<insert your domain here>" 2.) set a {"ansible_host": "{{ inventory_hostname }}.<insert your domain here>"} netbox_inventory.yml config_context: true
flatten_config_context: true 3.) set this in your compose:
ansible_host: "{{ inventory_hostname }}.<insert your domain here>" |
Beta Was this translation helpful? Give feedback.
-
Hello team, thanks for the responses. @candlerb, I have tried and its not working. Once I detach the loopback interface from the physical interface I can no longer use it as the device's primary IP. Check the error message on the image below. |
Beta Was this translation helpful? Give feedback.
-
Unless I'm misunderstanding you, I don't think that's true at all. Create a virtual loopback interface on the device and assign an ip as primary and I believe it should work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Team!
I am working on my automation solution and have integrated my Netbox instance into Ansible AWX as the inventory. I intend to manage my device through the loopback address. However, I have realized that loopback interface details are not imported into Ansible as (host vars) unless they're associated with physical interfaces on the device.
In the networking world loopback interfaces are not associated with physical interfaces and I was of the opinion that it should be the same in my documentation.
Does anyone understand why it's designed like that in Netbox and or if the best way to do it?
Beta Was this translation helpful? Give feedback.
All reactions