Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Latest commit

 

History

History

tutorials

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Tutorials for the batfish.base role

This repository contains example playbooks that show how to use Batfish in conjunction with Ansible.

Setup

  • Ensure that Docker is installed and running on your machine.

  • Install the latest version of the batfish.base role from Ansible Galaxy.

    ansible-galaxy install --force batfish.base

    • If you encounter any issues related to SSL certificates use the -c option.
  • Clone or download this repository to your local machine, and run the setup playblook.

  • Setup Batfish on your local machine

    cd tutorials

    ansible-playbook -i inventory playbooks/batfish_setup.yml

    This playbook will download and install the latest Batfish docker container, Pybatfish SDK and other Python requirements. It has some rudimentary error checking built into it:

    • Aborts if Docker is not running.
    • Warns if it does not detect a Python virtual environment and ask you to confirm that you want to proceed with the installation.

Running a tutorial

We highly recommend that you run the tutorials in a Python 3 virtual environment. Details on how to set one up can be found here.

From the tutorials directory, run specific tutorials via

ansible-playbook -i inventory playbooks/tutorial1_extract_facts.yml

Each playbook is a standalone tutorial, it does not depend on other tutorials having been run first. So feel free to execute them in whatever order you think is best.

Batfish is designed to provide complete network analysis, which is why all tasks calling Batfish modules should set delegate_to: localhost and run_once: true. The tutorials are set up that way, so you can incorporate non-Batfish tasks that need to run across other hosts in your inventory.

Documentation