NetApp Solution Automation

Contributors Download PDF of this page

Procedure

To configure Mellanox switches using ansible playbooks via CLI, follow the below procedure:

  1. Download the Mellanox ONYX Ansible collections

    ansible-galaxy collection install -r collections/requirements.yml --force
  2. Download the Ansible content required for configuring the Mellanox switches

    git clone https://bitbucket.ngage.netapp.com/scm/ns-bb/na_with_mellanox.git
  3. Change the directory to the required solution

    cd na_with_mellanox/solutions/nar_hci_mellanox_deploy
  4. Fill the variables below based on the recommendations/suggestions provided. Once all the variables are filled as per requirement, copy the content by clicking 'Copy' button at the top.

# vars file for nar_hci_mellanox_deploy #Hosts group name #Default hosts group name - 'mellanox' #Change only if you are changing the hosts group name either in hosts file or in inventory groups in case of AWX/Tower hosts: mellanox #These set of variables will setup the Mellanox switches for NetApp HCI that uses a 2-cable compute connectivity option. #Ansible connection variables for mellanox ansible_connection: network_cli ansible_network_os: onyx # # Primary Variables # #Necessary VLANs for Standard NetApp HCI Deployment [native, Management, iSCSI_Storage, vMotion, VM_Network, IPL] #Any additional VLANs can be added to this in the prescribed format below
netapp_hci_vlans: - {vlan_id: 2, vlan_name: "OB_Management"} - {vlan_id: 3488, vlan_name: "IB_Managment"} - {vlan_id: 3489, vlan_name: "vMotion"} - {vlan_id: 3490, vlan_name: "iSCSI_Storage"} - {vlan_id: 3487, vlan_name: "Application"} - {vlan_id: 3491, vlan_name: "NFS"} - {vlan_id: 4000, vlan_name: "IPL"} - {vlan_id: 2, vlan_name: "Native"} More VLANs
Enter VLAN details
#LACP load balancing algorithm for IP hash method #Possible options are: 'destination-mac', 'destination-ip', 'destination-port', 'source-mac', 'source-ip', 'source-port', 'source-destination-mac', 'source-destination-ip', 'source-destination-port' #This variable takes multiple options in a single go #For eg: if you want to configure load to be distributed in the port-channel based on the traffic source and destination IP address and port number, use 'source-destination-ip source-destination-port' #By default, Mellanox sets it to source-destination-mac. Enter the values below only if you intend to configure any other load balancing algorithm #Make sure the load balancing algorithm that is set here is also replicated on the host side #Recommended algorithm is source-destination-ip source-destination-port lacp_load_balance: "source-destination-ip source-destination-port" #---------------------- # IPL variables #---------------------- #Inter-Peer Link Portchannel #ipl_portchannel to be defined in the format - Po100 ipl_portchannel: Po100 #Inter-Peer Link Addresses #The IPL IP address should not be part of the management network. This is typically a private network ipl_ipaddr_a: 10.0.0.1 ipl_ipaddr_b: 10.0.0.2 #Define the subnet mask in CIDR number format. Eg: For subnet /22, use ipl_ip_subnet: 22 ipl_ip_subnet: 24 #Inter-Peer Link Interfaces #members to be defined with Eth in the format. Eg: Eth1/1 peer_link_interfaces: description: "peer link interfaces" members: - "Eth1/20" - "Eth1/22" More Peer-Link InterfacesEnter peer-link Interface details #MLAG VIP IP address should be in the same subnet as that of the switches' mgmt0 interface subnet #mlag_vip_ip to be defined in the format - /. Eg: x.x.x.x/y and must be unique for each MLAG domain mlag_vip_ip: 10.195.60.111/24 #MLAG VIP Domain Name #The mlag domain must be unique name for each mlag domain. #In case you have more than one pair of MLAG switches on the same network, each domain (consist of two switches) should be configured with different name. mlag_domain_name: MLAG-VIP-DOM-10-16 #--------------------- # Interface Details #--------------------- #Storage Bond10G Interface details #members to be defined with Eth in the format. Eg: Eth1/1 #Only numerical digits between 100 to 1000 allowed for mlag_id #Operational link speed [variable 'speed' below] to be defined in terms of bytes. #For 10 Gigabyte operational speed, define 10G. [Possible values - 10G and 25G] #Interface descriptions append storage node data port numbers assuming all Storage Nodes' Port C -> Mellanox Switch A and all Storage Nodes' Port D -> Mellanox Switch B #List the storage Bond10G interfaces, their description, speed and MLAG IDs in list of dictionaries format storage_interfaces: - {members: "Eth1/13", description: "HCI_Storage_Node_01", mlag_id: 113, speed: 10G} - {members: "Eth1/14", description: "HCI_Storage_Node_02", mlag_id: 114, speed: 10G} - {members: "Eth1/15", description: "HCI_Storage_Node_03", mlag_id: 115, speed: 10G} - {members: "Eth1/16", description: "HCI_Storage_Node_04", mlag_id: 116, speed: 10G} More Interfaces towards Storage Nodes
Enter Storage Interface details
#Storage Bond1G Interface #Mention whether or not these Mellanox switches will also be used for Storage Node Mgmt connections #Possible inputs for storage_mgmt are 'yes' and 'no' storage_mgmt: no #Storage Bond1G (Mgmt) interface details. Only if 'storage_mgmt' is set to 'yes' #Members to be defined with Eth in the format. Eg: Eth1/1 #Interface descriptions append storage node management port numbers assuming all Storage Nodes' Port A -> Mellanox Switch A and all Storage Nodes' Port B -> Mellanox Switch B #List the storage Bond1G interfaces and their description in list of dictionaries format storage_mgmt_interfaces: - {members: "Eth1/5", description: "HCI_Storage_Node_01"} - {members: "Eth1/6", description: "HCI_Storage_Node_02"} - {members: "Eth1/7", description: "HCI_Storage_Node_03"} - {members: "Eth1/8", description: "HCI_Storage_Node_04"} More management interfaces towards storage nodes
Enter Storage Management Interface details
#Compute Interface details #Members to be defined with Eth in the format. Eg: Eth1/1 #Fill the mlag_id field only if you intend to configure interfaces of compute nodes into bond or LAG with LACP #In case you do not intend to configure LACP on interfaces of compute nodes, either leave the mlag_id field unfilled or comment it or enter NA in the mlag_id field #In case you have a mixed architecture where some compute nodes require LACP and some don't, #1. Fill the mlag_id field with appropriate MLAG ID for interfaces that connect to compute nodes requiring LACP #2. Either fill NA or leave the mlag_id field blank or comment it for interfaces connecting to compute nodes that do not require LACP #Only numerical digits between 100 to 1000 allowed for mlag_id. #Operational link speed [variable 'speed' below] to be defined in terms of bytes. #For 10 Gigabyte operational speed, define 10G. [Possible values - 10G and 25G] #Interface descriptions append compute node port numbers assuming all Compute Nodes' Port D -> Mellanox Switch A and all Compute Nodes' Port E -> Mellanox Switch B #List the compute interfaces, their speed, MLAG IDs and their description in list of dictionaries format compute_interfaces: - members: "Eth1/2" description: "HCI_Compute_Node_01" mlag_id: #Fill the mlag_id only if you wish to use LACP on interfaces towards compute nodes speed: 10G - members: "Eth1/4" description: "HCI_Compute_Node_02" mlag_id: 104 #Fill the mlag_id only if you wish to use LACP on interfaces towards compute nodes speed: 10G More interfaces towards compute nodes
Enter Compute Interface details
#Spanning-tree protocol type for uplink connections. #The valid options are 'network' and 'normal'; selection depends on the uplink switch model. uplink_stp_type: network #Uplink Switch LACP support #Possible options are 'yes' and 'no' - Set to 'yes' only if your uplink switch supports LACP uplink_switch_lacp: yes #Uplink Interface details #Members to be defined with Eth in the format. Eg: Eth1/1 #Only numerical digits between 100 to 1000 allowed for mlag_id. #Operational link speed [variable 'speed' below] to be defined in terms of bytes. #For 10 Gigabyte operational speed, define 10G. [Possible values in Mellanox are 1G, 10G and 25G] #List the uplink interfaces, their description, MLAG IDs and their speed in list of dictionaries format uplink_interfaces: - members: "Eth1/18" description_switch_a: "SwitchA:Ethx/y -> Uplink_Switch:Ethx/y" description_switch_b: "SwitchB:Ethx/y -> Uplink_Switch:Ethx/y" mlag_id: 118 #Fill the mlag_id only if 'uplink_switch_lacp' is set to 'yes' speed: 10G mtu: 1500 More interfaces towards uplink switchesEnter Uplink Interface details
  1. Create a new variable file (yml file) in the current directory (directory same as that of the playbook) and paste the copied variables into the file and save it.

  2. Fill the IP addresses/hostnames of Mellanox switches below and copy the content. Open the hosts file, clear all the information present and paste the copied content to it.

[mellanox] x.x.x.x id="A" #IP Address of the Mellanox Switch A y.y.y.y id="B" #IP Address of the Mellanox Switch B
  1. Run the playbook by passing the variable file and mellanox switch username. Fill the password for Mellanox switches when prompted.

ansible-playbook -i hosts nar_hci_mellanox_deploy_playbook.yml -u mellanox_switch_username -k -e @mellanox_vars.yml
Note Replace mellanox_switch_username with the appropriate username for logging in the mellanox switches before running the playbook with above command.