# Ansible + Arista + Netbox

**URL:** <https://forum.ansible.com/t/ansible-arista-netbox/37802>\
**Category:** Ansible Project\
**Created:** [March 23, 2023, 12:57am UTC](https://forum.ansible.com/t/ansible-arista-netbox/37802 "2023-03-23T00:57:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Jones](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Ben\_Jones](https://forum.ansible.com/u/Ben_Jones)\
**Post date:** [March 23, 2023, 12:57am UTC](https://forum.ansible.com/t/ansible-arista-netbox/37802/1 "2023-03-23T00:57:02Z")

</div>

Hello!

this might be quite specific, but I’m loosing the will…

We’re trying to automate our switch configuration using Ansible with Netbox providing the configurations.

I’ve got a dynamic inventory xml which is generated by querying Netbox via the Rest API based on tags.

I want the playbook to pull all the switch information from Netbox and push it to the relevant switch.

I’ve had this working for a single switch on a single interface, but after trying for many hours, I can’t get it to loop through each interface on each switch.

Is anyone doing anything similar? Is this even a good idea? What am I doing with my life?

---

<div class="post-metadata">

**Author:** ![kyle\_jones](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kyle_jones/32/2553_2.png) [@kyle\_jones](https://forum.ansible.com/u/kyle_jones)\
**Post date:** [March 23, 2023, 3:54pm UTC](https://forum.ansible.com/t/ansible-arista-netbox/37802/2 "2023-03-23T15:54:06Z")

</div>

Hey Ben,

I feel your pain when it comes to designing automation for something. Are you use making your decision making based on the facts pulled from the switch? Care to share a playbook and a debug of the facts you want to loop through?

---

<div class="post-metadata">

**Author:** ![Heinz\_Meier](https://avatars.discourse-cdn.com/v4/letter/h/7ba0ec/32.png) [@Heinz\_Meier](https://forum.ansible.com/u/Heinz_Meier)\
**Post date:** [March 23, 2023, 9:15pm UTC](https://forum.ansible.com/t/ansible-arista-netbox/37802/3 "2023-03-23T21:15:24Z")

</div>

I am doing this with Cisco. If you understood what you are doing, it is quite simple.

Use the netbox inventory pluging. Be sure to gather the interface information (interfaces: true).  
Then use the arista.eos.eos\_interfaces module and loop over all interfaces. (or arista.eos.eos\_l2\_interfaces).

Please contact me directly if you have further questions: [ms@sys4.de](mailto:ms@sys4.de)

At the moment I am compiling some document to describe the network automation with netbox and ansible.

Michael Schwartzkopff
