Skip to content

bitcollector1/netbox-auto-provision-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

netbox-auto-provision-scripts (Work in Progress)

Two scripts created to import Linux servers into NetBox. Tested on Ubuntu and CentOS. All hosts should have LLDP enabled so connections can be mapped in NetBox.

The main provision script is intended to be run on a child device (server) that will be racked into a parent chassis. In our case since most of our servers are blade types we choose to rack 1 node systems into a parent chassis for overall consistency. This script was tested on 1 Node parent/child as well.

  1. Seed NetBox with server data gathered with NorNir and Napalm via LLDP and ARP info. The minios script creates a base system in NetBox.

You can bypass the script and just create a base system (CSV Import) in NetBox as shown below and run the main provision script on that.

Provision script must have a "Base" system in place. If you used the seed script you will also have IP's you need to add to /etc/host file so no DNS is needed for SSH to work.

shell-system-no-interface-ip

This is the parent chassis that the script is going to install the child server into, it will also add power connections and info based off server

parent-empty-bay-no-power

The main provision script will take the shell from above and fill in many key details for you automatically.
  1. Gather all facts about a server and add them to NetBox. This includes manafucturer, product type, serial number, asset tags, ethernet interface and IP BMC interface and IP and it will also make the interface connections in NetBox based of LLDP information it finds so that you will be able to see the active LLDP connections in NetBox GUI.

  2. Still a work in progress as time allows but there are lots of things I'd like to fix in this script. It's a learning process and grew very organically.

Final State with Device Type, Serial, Role, Rack, Status, and Custom Fields for BIOS and BMC info System-Info

LLDP used to make the connections in netbox, ARP and IPMITOOL used to find ETH and BMC IP addresses LLDP-Interface-IP

Child Server is racked into the parent based off the chassis serial number. Set the node as a script option. Script still works if wrong node selcted, it will just leave the system unracked. Run the script again with the correct node and it will slot it correctly.
Device Bay

Power connections created on the chassis and max power and allocation also set. Power-Chassis

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages