Configuration Management
Let's learn about the process of configuration management involved in network automation.
We'll cover the following
Achieving full network configuration management
Ultimately, the goal of network automation is to provide complete coverage of all network configurations and the required changes to those configurations. One-time, tactical playbooks are incredibly powerful. However, these playbooks are simply moving the execution of CLI commands from human input to an automation engine. While network reconnaissance and executing tactical commands can be performed at scale, full network configuration management has not yet been achieved. This is because no source of truth exists. The network is not yet intent-based, since there is no automated provisioning. The powerful dynamic templating engine has not been put into use.
Automated documentation and configuration management involves the abstraction of data from network configurations. Data models are built around the relevant information a device contains. The actual configuration commands are then transformed into templates. Variables are substituted with the information contained in the data models at runtime, making the templates dynamic. Standardized golden templates ensure configuration consistency derived from intent is applied at scale.
Expand on the utilization of the ios_config
module to automate
network configuration management. For the most part, code will continue
to be written as YAML files. However, now Jinja2 templating is introduced to
hold the mix of programmatic logic and static commands to build new
templates.
The process can be done in any order, but here are the building blocks needed to automate network configuration management:
-
Create
group_vars
andhost_vars
variables in the data dictionary. The variables will have a YAML file format.- This allows us to abstract the data (IP addresses, routes, ACLs, VRFs, network constructs, etc.) from the actual Cisco IOS CLI device configuration itself. Extract the important data and abstract it from the running configuration of the device itself.
-
Create small templates in Jinja2 file format that generate configurations. This has several uses such as:
-
Dynamic templates
-
Mix of static text, variables, and programmatic logic
-
Variables replaced with information from
group_vars
andhost_vars
-
For
loops to iterate over lists -
Basic
if
,else
, andend if
comparative Boolean logic
-
-
Create tasks:
-
Done in YAML file format
-
Use Cisco
ios_command
module -
Call the templates
-
Assemble the templates
-
-
Create playbooks:
-
Identify scope, and which devices to execute tasks on
-
Call the tasks
-
Execute using the
ansible-playbook
command and options
-
Get hands-on with 1200+ tech skills courses.