Setting up the environment#
To demonstrate the intent-based configuration management with Ansible we prepared a lab environment that you can set up on your own machine1. The lab environment consists of a small SR Linux-based Clos fabric that is going to be configured by Ansible using intents declared in the Ansible roles.
Readers should have a basic understanding of SR Linux and its network constructs to understand what this project does. Things like mac-vrfs, network instances, irb's, sub-interfaces, etc. should be familiar. For SR Linux newcomers we recommend first reading the SR Linux documentation to familiarize with the basic concepts.
Make sure Ansible (ansible-core) 2.9+ is installed. We recommend you run Ansible from a Python virtual environment, for example:
We recommend you install the fcli tool that generates fabric-wide reports to verify things like configured services, interfaces, routes, etc.
fcliis not required to run the project, but it's useful to verify the state of the fabric after running the playbook and is used throughout this tutorial to illustrate the effects of the Ansible playbooks.
Installing the Ansible collection#
Install the SR Linux Ansible collection from Ansible Galaxy with the following command:
Clone the project repository#
The entire project is contained in the intent-based-ansible-lab repository. Following command will clone the repository to the current directory on your machine (in
The following sections assume you are in the
Deploying the lab#
You need an SR Linux test topology to run the Ansible playbook and roles against. We will use Containerlab to create a lab environment with 6 SR Linux nodes: 4 leaves and 2 spines:
This will create a lab environment with 6 SR Linux nodes and a set of Linux containers to act as hosts:
Containerlab populates the
/etc/hosts file on the host machine with the IP addresses of the deployed nodes. This allows Ansible to connect to the nodes that has a matching inventory file inside the
With the lab deployed, we can now explore the project's structure and understand the role's layout that powers the intent-based configuration management.