Adding a New Device to Nautobot¶
Nautobot is the Source of Truth (SoT) aggregation layer that has been chosen. In this section, you will review how to create a new Device in Nautobot and the dependencies that need to be satisfied to accomplish this task.
How to add a new device to Nautobot¶
First, you will review the necessary dependencies on multiple levels in order to create a Nautobot device. Then you will review three methods to execute this task:
- Using the web UI.
- Using the Nautobot Ansible Collections.
- Using API calls.
Dependencies¶
There are three levels of dependencies that affect the creation of a Nautobot device. These dependencies align with the goal of Nautobot to represent real world devices with the required characteristics:
First level:
- Site: A device has a physical location, therefore a Site object is required to represent this location. Sites depend on the nature of your organization, for example a site for a bank may be a branch.
- Device Type: A device has a specific model, therefore a DeviceType object needs to be created to characterize it. Once a device type is added to the device, its default components such as console ports, power ports, and interfaces will be assigned to it.
- Device Role: A DeviceRole object indicates the function of a device within an organization, whether it operates as a core/distribution/access switch, router, firewall etc. It is a first level dependency since a device always has a specific purpose.
Second level:
- Site
- name: To create a
Sitea unique name needs to be provided as astring. - slug: A slug string is required to standardize how the name is referenced.
- name: To create a
- Device Type
- Manufacturer: A Manufacturer object, i.e., the "make" of a device, needs to be assigned to each
DeviceType. - model: The model is a unique name provided as a
string. - slug: A slug string is required to standardize how the name is referenced.
- Manufacturer: A Manufacturer object, i.e., the "make" of a device, needs to be assigned to each
- Device Role
- name: The unique name of the role needs to be provided as a string.
- slug: A slug string is required to standardize how the name is referenced.
Third level:
- Manufacturer
- name: To create a
Manufacturerobject you need to provide a name as a string. - slug: A slug string is required to standardize how the name is referenced.
- name: To create a
Next, you will review three different ways to satisfy these dependencies.
Using the Web Interface¶
NTCU - SKIP
Using Ansible¶
There is a rich set of Ansible Collections for Nautobot that can perform all the above operations programmatically:
-
Create a
Site:Below we show an example with
Sitescorresponding to states. -
Create a
Device Type&Manufacturer:A set of random manufacturers with name
Test Manufactureris created and then a set of test device types, with modelDEV-01. Each name string has two digits concatenated at the end.- name: Create manufacturer within Nautobot with only required information networktocode.nautobot.manufacturer: url: http://nautobot.local token: thisIsMyToken name: Test Manufacturer state: present - name: Create device type within Nautobot with only required information networktocode.nautobot.device_type: url: http://nautobot.local token: thisIsMyToken slug: test-device-type model: DEV-01 manufacturer: Test Manufacturer state: present -
Create a
Device Role:Device roles are created from a list of device roles in the example below.
-
Create a
Device:Finally, a device is created with the role, site, and type previously created.