Supplemental Exercise: Ansible Network Resource Modules

Read this in other languages: uk English, japan 日本語.

Table of Contents

Objective

Demonstration use of Ansible Network Resource Modules

This exercise builds upon exercise 4 - Ansible Network Resource Modules. Please complete that exercise before starting this one.

There are two parts to this exercise:

  1. Cover additional configuration state parameters:

and contrast them to what we saw with merged.

  1. Cover additional read-only state parameters

and contrast them to the gathered parameter.

Step 1 - Manually modify the Arista configuration

Step 2 - Run the playbook

Step 3 - Modify the playbook

Step 4 - Run replaced playbook

Step 5 - Add a VLAN to rtr2

  rtr2#show vlan
  VLAN  Name                             Status    Ports
  ----- -------------------------------- --------- -------------------------------
  1     default                          active   
  20    desktops                         active   
  30    servers                          active   
  40    printers                         active   
  50    DMZ                              active   
  100   artisanal                        active   

Step 6 - Use overridden parameter

Step 7 - using rendered parameter

Now lets return to using read-only parameters. These parameters do not modify the configuration on a network device. In exercise 4, we used the state: gathered to retrieve the VLAN configuration from the Arista network device. This time we will use rendered to get the Arista commands that generate the configuration:

Step 8 - Using the parsed parameter

Finally lets cover the parsed parameter. This parameter is used when a existing file contains the network device configuration. Imagine there was already a backup performed.

Takeaways

We covered two additional configuration state parameters:

Going from merged to replaced to overridden follows the automation adoption journey as network teams gain more confidence with automation.

We covered additional read-only state parameters

These allow network automators to use resource modules in additional scenarios, such as disconnected environments. Network resource modules provide a consistent experience across different network devices.

The documentation guide provided additional info of using network resource modules.

Solution

The finished Ansible Playbook is provided here for an answer key:

Complete

You have completed the supplemental lab!


Click here to return to supplemental exercises

Click here to return to the Ansible Network Automation Workshop