Metadata-Version: 2.3
Name: nautobot-auto-provisioner
Version: 1.1.0
Summary: Nautobot Auto Provisioner
License: Apache-2.0
Keywords: nautobot,nautobot-app,nautobot-plugin
Author: Dwayne Camacho
Author-email: dwayne.a.camacho@gmail.com
Requires-Python: >=3.8,<3.13
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: all
Requires-Dist: nautobot (>=2.3.2,<3.0.0)
Requires-Dist: nautobot-golden-config (>=2.2,<3.0)
Project-URL: Documentation, https://docs.nautobot.com/projects/nautobot-auto-provisioner/en/latest/
Project-URL: Homepage, https://github.com/d-camacho/nautobot-auto-provisioner
Project-URL: Repository, https://github.com/d-camacho/nautobot-auto-provisioner
Description-Content-Type: text/markdown

# Nautobot Auto Provisioner

<p align="center">
  <img src="https://github.com/d-camacho/testing_readme/blob/main/images/auto_prov_full_logo.png "class="logo" height="200px">
  <br>
  An <a href="https://networktocode.com/nautobot-apps/">App</a> for <a href="https://nautobot.com/">Nautobot</a>.
</p>

## Overview

**Auto Provisioner** is a Nautobot Plugin that enables you to push configurations to both new and existing devices. You can select a Git repository from Nautobot Git Repositories—currently supported with the backup or intended config repository managed by Golden Config—as the source for your configurations.

This project was inspired after the successful completion of [#100DaysOfNautobot](https://go.networktocode.com/100-days-of-nautobot).

Auto Provisioner provides three core Nautobot Jobs, each tailored to a specific operational use case.

![Auto Provisioner Jobs](https://github.com/d-camacho/nautobot-auto-provisioner/blob/main/docs/images/all_jobs.png)

---

## Use Cases

> [!IMPORTANT] 
For all use cases, it is assumed that **Nautobot has IP connectivity with the target device** being provisioned. Ensure devices are reachable before running any jobs.

> [!TIP] 
When provisioning new devices, consider using technologies such as DMVPN, DHCP reservations, or similar solutions to establish initial connectivity with minimal configuration. Once basic reachability is in place, Auto Provisioner can handle the rest.

This plugin addresses the following use cases:

### Use Case 1: Baseline Existing Device (from Backup)

**Baseline Existing Device Job** lets users push an entire configuration to a selected device to restore it to a known-good state. In dynamic environments where changes are made to support temporary operational needs, this job helps eliminate configuration drift by reverting the device to its last-known-good backup stored in the repo.

![Baseline Existing Device](https://github.com/d-camacho/nautobot-auto-provisioner/blob/main/docs/images/baseline_job.png)

### Use Case 2: Baseline Existing Device (from Intended)

The **same job** can also be used to push newly generated **intended configurations**. For example, if your organization rolls out a new security standard or feature update, you can use this job to apply those changes to the device using your intent-based templates from the intended config repository.

### Use Case 3: Replace Existing Device

The **Replace Existing Device Job** is designed for situations where hardware must be replaced—whether due to failure, upgrade, or lifecycle refresh. This job retains all existing metadata in Nautobot (like role, location, IP, etc.) and applies it to the new device. It also allows for updates to attributes like device type and serial number, ensuring that your source of truth remains accurate.

![Replace Existing Device](https://github.com/d-camacho/nautobot-auto-provisioner/blob/main/docs/images/replace_existing.png)

### Use Case 4: Provision New Device

**Provision New Device Job** enables users to create and provision a completely new device in Nautobot. The job prompts for required metadata (like hostname, IP address, and interface), creates the device object, and then pushes the appropriate configuration from the selected repository.

![Provision New Device](https://github.com/d-camacho/nautobot-auto-provisioner/blob/main/docs/images/provision_new.png)


---

## Installing the App in Nautobot

### Prerequisites

1. The app relies on ```nautobot-golden-config``` and its associated dependencies.
2. It uses Golden Config's ```backup configs``` and ```intended configs``` as Git Repositories in Nautobot.
3. For help configuring Git Repositories, refer to the [Golden Config Documentation](https://docs.nautobot.com/projects/golden-config/en/latest/admin/install/#app-configuration).

### Install Guide

**Auto Provisioner** is Python package published in [pypi.org/project/nautobot-auto-provisioner](https://pypi.org/project/nautobot-auto-provisioner/).

#### Standard Install (non-Docker)

Install using pip:

```bash

pip install nautobot-auto-provisioner
```

After installation, **add** the plugin to the ```PLUGINS``` list in your ```nautobot_config.py```:

```python
PLUGINS = ["nautobot_auto_provisioner"]
```

Restart the Nautobot service.

To ensure Nautobot Auto Provisioner is automatically reinstalled during upgrades, **append** ```nautobot-auto-provisioner``` to your instance's ```requirements.txt```.

#### Docker Compose Install

Add the plugin to the project dependencies in ```pyproject.toml```

```bash
poetry add nautobot-auto-provisioner
```

Regenerate and lock dependencies:

```bash
poetry lock
poetry install
```

Update the Docker image:

```bash
invoke build
```

Start Nautobot:
```bash
invoke start
```
Or if you prefer debug mode:
```bash
invoke debug
```

Be sure to **update** the ```PLUGINS``` list in your ```nautobot_config.py```:

```python
PLUGINS = ["nautobot_auto_provisioner"]
```

## Future Updates

1. Future versions will support user defined Git Repos to decouple from Golden Config's backup and intended configs for greater fexibility. This will allow users who already have a different proces for backups or generating intended configs.

2. Wider support for credentials used to connect to devices. Currently, credentials are based on Nautobot's Secret Group but future iterations may support other methods.


## Feedback

All feedbacks are welcome! This project began as part of a Nautobot learning journey and demonstrates key concepts like Nautobot Job creation, class-based approach, and plugin development. Open a topic under **Discussion** to share your ideas or ask questions.

Let's learn Nautobot together!
