Compliance checks: console links, loopbacks, parent prefixes, and operational guardrails.
Nautobot Jobs
Why Jobs matter
Jobs turn Nautobot’s source-of-truth data into controlled, repeatable automation endpoints — with inputs, permissions, execution, logs, and results handled by the platform.
Reserve prefixes, prep new locations, bulk-update objects, or perform governed writes.
Fetch external data and import it into Nautobot through a traceable workflow.
Mental model
Separate the code you ship from the record Nautobot runs.
metadata + variables
run() method
enabled/name
queue config
schedule / hook
operator inputs
Kubernetes pod
executes logic
visible in UI/API
auditable trail
Anatomy of a Job
The smallest useful unit combines user inputs, metadata, a run method, and explicit registration.
from nautobot.apps import jobs
name = "Examples"
class HelloWorldJob(jobs.Job):
who = jobs.StringVar(default="world")
class Meta:
name = "Hello World"
def run(self, *, who):
self.logger.info("Hello, %s!", who)
jobs.register_jobs(HelloWorldJob)
Build checklist
variables
User inputs become the form and API payload.
Meta
Controls how the Job appears and behaves.
run()
The execution entry point.
register_jobs()
Required for discovery.
Operate safely in production
Preview what will change; require an explicit commit path for writes.
A second run should converge, not create duplicate objects.
Avoid infinite loops or daemons; use schedules for recurring work.
Use permissions and approvals where the blast radius justifies it.
Log inputs, decisions, skipped items, and failures at the right level.
Keep variables simple; validate external data before updating Nautobot.
Demo runbook
- Create
Implement a tiny read-only check first. - Register
Callregister_jobs()so Nautobot discovers it. - Enable
Use the Job record to turn availability on. - Run
Supply inputs through UI, API, CLI, schedule, or hook. - Review
Check JobResult, logs, and generated files.
# 1. add code under JOBS_ROOT
vim $NAUTOBOT_ROOT/jobs/compliance.py
# 2. discover new Job records
nautobot-server post_upgrade
# 3. inspect CLI options
nautobot-server help runjob
# 4. execute when ready
nautobot-server runjob --commit <job>
Nautobot Jobs turn automation into an interface.
ship code · control access · queue execution · observe results
next: convert one recurring manual network check into a read-only Job with strong logs.