Key insights from developing Nautobot and Ansible integrations
文章介绍了项目工作集中在Nautobot的数据结构、REST API、与Ansible的集成以及从Nautobot运行Ansible playbook上。重点讨论了数据结构中的挑战与解决方案,如UUID的使用确保设备和接口名称唯一性,并选择了Django shell进行自动化开发。 2025-9-20 19:3:33 Author: www.adainese.it(查看原文) 阅读量:13 收藏

Post cover

Beyond the topics discussed in previous posts, my work on this project focused on four key areas: The data structure of Nautobot Nautobot’s

Beyond the topics discussed in previous posts, my work on this project focused on four key areas:

  • The data structure of Nautobot
  • Nautobot’s REST API
  • Integrating Ansible with Nautobot
  • Running Ansible playbooks from Nautobot

Let’s dive into the challenges encountered and the solutions omitted from previous posts.

Nautobot’s data structure

Effectively using Nautobot requires careful planning of the data structure to avoid costly changes later. Understanding this structure allows for simplifications in automation scripts.

Each object in Nautobot is identified by a UUID, such as 2170a207-43b2-422a-a90d-51a4908b85fb. This choice allows any attribute to be changed without issues. Since the device identifier is a UUID and not a name, we must consider:

  • Can two devices have the same name?
  • Can two interfaces on the same device have the same name?

Quick tests reveal that the answer is no to both questions, allowing for safe simplifications in automation scripts.

Django shell

Nautobot is built on Django , a Python-based web application framework. Django provides a shell for easy interaction with the data structure.

The decision had to be made whether to develop automations using the shell or the REST API.

The shell can be invoked using the command:

Continue reading the post on Patreon .


文章来源: https://www.adainese.it/blog/2024/07/12/key-insights-from-developing-nautobot-and-ansible-integrations/
如有侵权请联系:admin#unsafe.sh