NVIDIA Onyx User Manual v3.10.2202
NVIDIA MLNX-GW User Manual for NVIDIA Skyway Appliance v8.2.2200

Ansible

Ansible works by configuring client machines from a computer with Ansible components installed and configured. It communicates over normal SSH channels to retrieve information from remote machines, issue commands, and copy files. Therefore, an Ansible system does not require any additional software to be installed on the client computers. Any server that has an SSH port exposed can be brought under Ansible's configuration umbrella, regardless of what stage it is at in its life cycle.

Ansible takes on a modular approach, making it easy to extend to use the functionalities of the main system to deal with specific scenarios. Modules can be written in any language and communicate in standard JSON. Configuration files are mainly written in the YAML data serialization format due to its expressive nature and its similarity to popular markup languages. Ansible can interact with clients through either command line tools or through its configuration scripts called Playbooks.

For a list of Ansible’s supported modules, please refer toNVIDIA Onyx modules page on Ansible.com and the modules location themselves.

  1. Make sure CentOS 7 EPEL repository is installed:

    Copy
    Copied!
                

    sudo yum install epel-release

  2. Install Ansible:

    Copy
    Copied!
                

    sudo yum install ansible

  3. .Configuring the Ansible hosts (file includes the switches to be accessed)

    1. Open the vim /etc/ansible/ansible.cfg file and search for the host_key_auto_add.

    2. Un-comment it as shown in the example below.

      Copy
      Copied!
                  

      When using persistent connections with Paramiko, the connection runs in a background process. If the host doesn’t already have a valid SSH key, by default Ansible will prompt to add the host key. This will cause connections running in the background processes to fail. Uncomment this line to have Paramiko automatically add host keys. #host_key_auto_add = TRUE

    3. Open the /ansible/hosts file with root privileges

      Copy
      Copied!
                  

      vi /etc/ansible/hosts

      Keep output file for future more complex Ansible configuration scenarios.

    4. Add switch information to the following configuration file, based on the following examples:

      1. EX1: switch132; ansible_host=10.209.37.249; ansible_user=admin; ansible_ssh_pass=admin

      2. EX2: switch131; ansible_host=l-csi-2700-l05; ansible_user=admin; ansible_ssh_pass=admin

  1. Create a .yml file under /etc/ansible

    Copy
    Copied!
                

    touch <file_name>.yml

    Playbook example:

    Copy
    Copied!
                

    hosts: switch132 gather_facts: no connection: network_cli become: yes become_method: enable vars: ansible_network_os: onyx tasks: onyx_vlan: vlan_id: 20 name: test-vlan

    where:

    hosts

    List of switches required for running this yml file on

    tasks

    List of required tasks

    onyx_vlan

    Desired module name

    vlan_id

    Module variables

  2. Run the playbook.

    Copy
    Copied!
                

    ansible-playbook <path_of_yml file> -i /etc/ansible/host -vvvvv –check

Warning

Full module variables explanation, and examples of playbooks can be created for each module of Onyx modules supported by Ansible.
All Onyx-supported modules in Ansible are available in the following link: https://docs.ansible.com/ansible/devel/modules/list_of_network_modules.html#onyx.
The Onyx modules are available in the following path: lib/ansible/modules/network/onyx, where any module can be run in order to see the structure of the playbook.

© Copyright 2023, NVIDIA. Last updated on May 23, 2023.