Create NetBox API Token for Airflow
Introduction
This task will provision an API key in NetBox to allow Netos Pod (Airflow) to pull and push data into NetBox. The playbook will perform the following steps:
- Create a NetBox user called
airflow_api
with asuperuser
role. - Generate an API key for the airflow_api user (meaning that any updates from Airflow are clearly attributed to Airflow, i.e. Netos Pod).
- Configure the
NETBOX_API_KEY
variable in Airflow.
This solution assumes that Airflow is running on the local server. For remotely connected NetBox <> Netos Pod configurations, please set the API manually in Airflow.
The Playbook
The "Create API User" task failed because the user exists. In this case it will refresh the token used by Airflow.
Airflow
The NetBox API key is created. If the key is wrong, the Global Orchestration DAG will not start and will show an authentication error in the logs.