Skip to content

Project Inventory Set Up

tchiapuziowong edited this page May 20, 2019 · 1 revision

Description

This explains how to set up your Ansible inventory and variable files to work with this project. Note that some workflows require specific variables to be defined therefore always verify within the workflow documentation that your inventory is properly setup.

Create Host Variable Files

  1. Switch to the "host_vars" directory
  2. Create ".yml" files with the MAC-Address of your CX devices ("-" separated) as name for each file.
    • Define variables ip, user, password, and hostname for each CX device. See cx-aa-bb-cc-dd-ee-ff_template.yml file as an example.
    • Example:
      • File Name : cx-d0-67-26-e2-21-ca.yml
      • Contents :
            ip: "10.10.16.65"     # Switch IP
            user: "admin"         # Switch Login User
            password: "admin"     # Switch Login Password
            hostname: "VSX-Primary"
  3. Create ".yml" files with the MAC-Address of your Switch device ("-" separated) as name for each file.
    • Define variables ip, sw_mac, and hostname for each Switch device. See sw-aa-bb-cc-dd-ee-ff_template.yml file as an example.
    • Example:
      • File Name : sw-91-1e-82-dd-f3-01.yml
      • Contents :
            ip: "10.10.16.151"     # Switch IP
            sw_mac: "91:1e:82:dd:f3:01"        # Switch Mac Address in colon format :
            hostname: "branch1-switch"

Create Group Variable Files

  1. Switch to "group_vars" directory and create ".yml" files for your group variables:
    1. Modify the file called branch1.yml . Change the variables peer1 and peer2 to match the names of your CX Host Variable files in Step 1.

      • Example Contents:
        # General Vars
        cx_group_name: "branch1_cxs"
        sw_group_name: "branch1_switches"
        
        # ZTP Vars
        peer1: "cx-d0-67-26-e2-21-ca"
        peer2: "cx-d0-68-39-e2-e4-cd"
    2. Modify the file called "branch1_cxs.yml". Change the variables user and password to match the credentials of your CX devices. The 'Config Generator' variables are used in the ArubaOS-Switch and ArubaOS-CX Config Generation example.

      • Example Contents:
        # General Vars
        group: "branch1"
        user: "admin"      # Username for ArubaOS-CX Switches
        password: "admin"  # Password for ArubaOS-CX Switches
        
        # Config Generator Vars - Example Values
        isl_link1: "1/1/47"
        isl_link2: "1/1/48"
        isl_link_description: "link to SWAG for ISL & SVI OSPF Peering"
        upstream_link: "1/1/1"
    3. Modify the file called "branch1_switches.yml". Change the variables user and password to match the credentials of your Switch devices. The 'Config Generator' variables are used in the ArubaOS-Switch and ArubaOS-CX Config Generation example.

      • Example Contents:
        group: "branch1"
        user: "admin"        # Username for AOS-Switch Switches
        password: "admin"    # Password for AOS-Switch Switches
        
        # ZTP Vars
        cx_port_subnet: "1.1.1.1" # Subnet for Port of 2930 Switch
        cx_port_gateway: "5.4.3.2" # Gateway for Port of 2930 Switch
        cx_port_vlan: 302 # VLAN Number for Port of 2930 Switch. In this example 302.
        
        # Config Generator Vars - Example Values
        uplinkvlan: 302
        uplinkvlanname: "VLAN302"
        uplinktrunk: "trk1"
        oobmip: "10.6.7.29"
        oobmmask: "255.255.255.0"
        oobmgw: "10.6.7.1"

Create Inventory File

  1. Switch to "inventory" directory. Modify the file called "hosts.yml" to match the information of your devices from Step 1 + 2:
    localhost
    
    # Repeat for all needed branches
    [branch1:children]  
    branch1_switches    
    branch1_cxs         
    
    [branch1_switches] # Can be filled by inventory_creation_scripts/create_host_vars.py
    sw-91-1e-82-dd-f3-01  # Enter ArubaOS-Switch-1 MAC Address separated by "-"
    
    [branch1_cxs]
    cx-d0-67-26-e2-21-ca  # Enter ArubaOS-CX-1 MAC Address separated by "-"
    cx-d0-68-39-e2-e4-cd  # Enter ArubaOS-CX-2 MAC Address separated by "-"