Ansible playbook development for network automation: Worked Example — Automation and Configuration (NVIDIA-Certified Professional: AI Networking)

Ansible Playbook Development for Network Automation: Worked Example Automation is a critical skill for the NVIDIA-Certified Professional: AI...

Ansible Playbook Development for Network Automation: Worked Example

Automation is a critical skill for the NVIDIA-Certified Professional: AI Networking certification, especially for managing complex AI networking environments efficiently. This worked example focuses on developing an Ansible playbook to automate network switch configuration using NVUE templates, a key component in NVIDIA's AI networking ecosystem.

Scenario

You are tasked with automating the configuration of multiple NVIDIA Mellanox switches to apply consistent VLAN and interface settings. The goal is to create an Ansible playbook that deploys NVUE templates to these switches, ensuring uniform configuration and reducing manual errors.

Step 1: Define the Objective

The playbook must:

Step 2: Prepare NVUE Template

Create an NVUE template file vlan_interface_config.nvue containing the desired configuration. For example:

vlan 100 { description "AI_Network_VLAN" interfaces [ "eth1/1", "eth1/2" ] }

This template defines VLAN 100 with a description and assigns it to interfaces eth1/1 and eth1/2.

Step 3: Create the Ansible Inventory

List the target switches in an inventory file inventory.ini:

[mellanox_switches] switch1 ansible_host=192.168.1.10 switch2 ansible_host=192.168.1.11

Step 4: Develop the Ansible Playbook

Create a playbook deploy_nvue.yml with the following structure:

--- - name: Deploy NVUE templates to Mellanox switches hosts: mellanox_switches gather_facts: no connection: network_cli tasks: - name: Copy NVUE template to switch copy: src: vlan_interface_config.nvue dest: /tmp/vlan_interface_config.nvue

More in this topic

Related topics:

#ansible #network-automation #nvidia-ai-networking #playbook-development #nvue

Ready to test your knowledge?

Put what you've learned into practice with a quick quiz and track your progress.

Test your knowledge →