Ansible runs on Linux based systems, and is installed as a Python package. Follow these steps to set up Ansible on your own system (they assume Python and Git are already installed and set up on Ansible host):
- Clone the NetBox Zero to Hero Git repository and change into the Ansible directory:
git clone https://github.com/netbox-community/netbox-zero-to-hero.git
cd netbox-zero-to-hero/ansible
- Create a new Python Virtual Environment and activate it:
python3 -m venv .
source bin/activate
- Upgrade PIP (Python package manager) and install Pynetbox (NetBox API client library), Ansible and the NetBox modules for Ansible using Ansible Collections:
python3 -m pip install --upgrade pip
pip3 install pynetbox
pip3 install ansible
pip3 install netaddr
ansible-galaxy collection install netbox.netbox
- Set up environment variables for NetBox (these are referenced by the Ansible playbooks):
export NETBOX_TOKEN=< YOUR_API_TOKEN >
export NETBOX_API=< YOUR_NETBOX_URL >
- When you have finished working deactivate the Python virtual environment:
deactivate