Creating your first Nautobot Job
In this section, you will be walked through two Nautobot Jobs to understand how to get started with Jobs. The first will be a Hello World Job that will introduce you to the structure and how to log to the Job Result page in the UI. The second example will provide a bit more context on building out Job form fields that enable self-service in the UI for users of your Jobs.
“Hello World” Nautobot Job
Remember your first Python script? It probably had a single print()
statement. We are going to start with the same for a Nautobot Job. There is only one difference: we are going to use Nautobot Job logging instead of print statements.
Our examples will use the JOBS_ROOT
method of placing a Job Python file into the Nautobot file structure.
Configure JOBS_ROOT open nautobot_config.py
as the nautobot
user and uncomment the following line:
JOBS_ROOT = os.getenv("NAUTOBOT_JOBS_ROOT", os.path.join(NAUTOBOT_ROOT, "jobs...