lenovo.cnos-vlag-1tier-leaf
Ansible Role: cnos-vlag-1tier-leaf - Single Layer vLAG Leaf Configuration
Role Description:
This Ansible role is used to set up a single layer vLAG (Virtual Link Aggregation Group) configuration. It is designed for access switches that connect to vLAG peers, which we will call leaf switches.
The role uses templates that are applied to configure the leaf switches, with different settings for each one since there are two leaf switches.
Tasks in the playbook will run or be skipped based on the flag settings for each IP address.
You can check the configuration commands and their results in the commands and results folders.
For more information, visit Configuring a single layer vLAG network.
Requirements
Role Requirements:
- Ansible version 2.3 or newer (Ansible installation guide)
- Lenovo switches with CNOS version 10.2.1.0 or higher
- SSH access to the Lenovo switch (SSH must be enabled)
Role Variables
Role Variables:
Here are the required inventory variables:
Variable | Description |
---|---|
ansible_connection |
Must be set to network_cli |
ansible_network_os |
Must be set to enos |
ansible_ssh_user |
The username to log into the switch |
ansible_ssh_pass |
The password to log into the switch |
Make sure to adjust these variables to fit your situation. You can find these variables in the vars directory of the role, specifically in the main.yml file.
To change the values in main.yml, use this format:
<template variable>:<value>
Replace <value>
with your specific setting, but keep <template variable>
as is.
Here’s a list of available variables:
Variable | Description |
---|---|
username |
Username for switch login |
password |
Password for switch login |
flag |
Condition flag for the switch |
stp_mode1 |
Configures the STP mode (mst - MSTP, rapid-pvst - Rapid PVST+, disable - STP off) |
port_range1 |
Ethernet port range |
portchannel_interface_number1 |
LAG number (1-4096) |
portchannel_mode1 |
LAG type (on - static LAG, active - active member of a LACP LAG, passive - passive member of a LACP LAG) |
slot_chassis_number1 |
Ethernet port (slot number/port number) |
switchport_mode1 |
Switch port mode (access - single VLAN, trunk - multiple VLANs) |
Dependencies
Role Dependencies:
username.iptables
- Sets up the firewall, allowing only necessary web and SSH ports.username.common
- Handles common server settings./etc/ansible/hosts
- Modify this file to include your leaf switches' information. You can use the cnos-vlag-1tier-leaf-hosts as a sample.
Ansible needs a hosts file to manage network elements. This file must be set up before running a playbook.
Open the /etc/ansible/hosts file with root access. You can comment out sections using #. Copy the role's content into this file from the main directory.
Example host entries might look like this:
[cnos-vlag-1tier-leaf]
10.240.178.74 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos condition=leaf_switch1
10.240.178.75 ansible_network_os=cnos ansible_ssh_user=<username> ansible_ssh_pass=<password> deviceType=g8272_cnos condition=leaf_switch2
Note: Update the IP addresses and replace <username>
and <password>
with your actual login details.
Example Playbook
Sample Playbook:
To run an Ansible playbook, use this command:
ansible-playbook cnos-vlag-1tier-leaf.yml -vvv
The -vvv
option will give you detailed output about what happens during playbook execution. The playbook files for this role are found in its main directory.
```
- hosts: cnos-vlag-1tier-leaf
roles:
- cnos-vlag-1tier-leaf
```
License
License Information:
Copyright (C) 2017 Lenovo, Inc.
This file is licensed under the Apache License, Version 2.0 (the "License"). You may not use this file unless in accordance with the License. The License can be found at:
http://www.apache.org/licenses/LICENSE-2.0
Software under the License is provided "AS IS", without warranties or conditions of any kind, either express or implied. See the License for details on rights and limitations.
The cnos-vlag-1tier_leaf role facilitates the configuration of the leaf switches in the PoD for VLAG in a Tier 1 fabric for switches running Lenovo's CNOS operating system.
ansible-galaxy install lenovo.cnos-vlag-1tier-leaf