Exercise 4: Ansible Network Resource Modules

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

If you are using an all Cisco workbench (all four routers are Cisco IOS routers) please switch to these directions.

Table of Contents

Objective

Demonstration use of Ansible Network Resource Modules

Ansible network resource modules simplify and standardize how you manage different network devices. Network devices separate configuration into sections (such as interfaces and VLANs) that apply to a network service.

Network resource modules provide a consistent experience across different network devices. This means you will get an identical experience across multiple vendors. For example the VLANs module will work identically for the following modules:

Configuring VLANs on network devices is an extremely common task, and mis-configurations can cause headaches and outages. VLAN configurations also tend to be identical across multiple network switches resulting in a perfect use case for automation.

This exercise will cover:

Guide

Step 1 - Verify VLAN configuration

As you can see in the output above there is no VLAN configuration outside of the default VLAN 1 (which is not assigned any ports).

Step 2 - Creating the Ansible Playbook

Step 3 - Examine the Ansible Playbook

Step 4 - Execute the Ansible Playbook

Step 5 - Verify VLAN configuration

As you can see, the resource module configured the Arista EOS network device with the supplied configuration. There are now five total VLANs (including the default vLAN 1).

Step 6 - Using the gathered parameter

Step 7 - Execute the gathered playbook

Step 8 - Examine the files

Takeaways

Solution

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

Complete

You have completed lab exercise 4

As stated previously only two of the resource modules parameters were covered in this exercise, but additional are available in the supplemental exercises.

In the next exercise we will start using Automation controller.

Previous Exercise | Next Exercise

Click here to return to the Ansible Network Automation Workshop