SALT

Salt is a different approach to infrastructure management, founded on the idea that high-speed communication with large numbers of systems can open new capabilities. This approach makes Salt a powerful multitasking system that can solve many specific problems in an infrastructure.

The backbone of Salt is the remote execution engine, which creates a high-speed, secure and bi-directional communication net for groups of systems. On top of this communication system, Salt provides an extremely fast, flexible, and easy-to-use configuration management system called Salt States.

For a list of Salt’s Napalm supported modules, please refer to the NAPALM-Onyx github repository.

  1. Install Salt packages:

    Copy
    Copied!
                

    curl -L https://bootstrap.saltstack.com -o install_salt.sh sudo sh install_salt.sh -P -M yum install -y salt-master salt-minion salt-ssh salt-syndic salt-cloud salt-api

  2. Install the Napalm library.

    Copy
    Copied!
                

    yum install epel-release yum install -y python-pip yum install libxml2-devel libxslt-devel zlib-devel gcc openssl-devel libffi-devel python-devel pip install pyzmq --install-option="--zmq=bundled" pip install napalm

  1. Open the /etc/salt/master file.

  2. Replace #interface: 0.0.0.0 with interface: <machine_ip>.

  3. Replace #hash_type: md5 with hash_type: sha256.

  4. Find file_roots and pillar_rootsand and add the following lines below them:

    image2019-4-23_19-25-0.png

  5. Save and quit by entering: wq

  6. Restart the Salt-master file:

    Copy
    Copied!
                

    sudo systemctl start salt-master.service sudo systemctl enable salt-master.service

After the installation, modify the /etc/salt/minion configuration file as below:

  1. Open the /etc/salt/minion file.

  2. Replace #master: salt with master: 10.99.0.10.

  3. Replace #hash_type: md5 with: hash_type: sha256.

  4. Save and quit by entering: wq

  5. Restart and enable Salt-minion.

    Copy
    Copied!
                

    sudo systemctl start salt-minion.service

  1. Run /etc/salt/proxy.

  2. Find the below attributes and fill them out as shown below:

    image2019-4-23_19-28-3.png

  1. Create a pillar directory under /etc/salt.

    Copy
    Copied!
                

    mkdir -r /etc/salt/pillar

  2. Go to the /etc/salt/pillar directory

  3. Create the top.sls file inside this directory.

    Per each switch, insert the following information:

    • DEVICE_ID

    • DEVICE_SLS_FILENAME

  4. Create a new file: [DEVICE_SLS_FILENAME].sls
    Insert the following information into the above file:

    Copy
    Copied!
                

    proxy: proxytype: napalm driver: [DRIVER] host: [HOSTNAME] username: [USERNAME] passwd: [PASSWORD]

    Example:

    Copy
    Copied!
                

    proxy: proxytype: napalm driver: onyx_ssh host: 10.209.37.247 username: admin passwd: admin propt_name: switch20 ssh_args:‘-0 PubkeyAuthentication=no’

  5. Restart Salt on the server in order to use the new configuration

    Copy
    Copied!
                

    systemctl stop salt-minion systemctl stop salt-master systemctl stop salt-proxy@<switch_name> systemctl start salt-master systemctl start salt-minion systemctl start salt-proxy@<switch_name>

The following Salt command can be used:

  1. Check if the switch is connected to the server running the Salt master:

    Copy
    Copied!
                

    salt onyx1 net.connected

  2. Run any command on the switch using net.cli (example: using “show version”):

    Copy
    Copied!
                

    salt onyx1 net.cli 'show version'

  3. Get the switch mac address:

    Copy
    Copied!
                

    salt onyx1 net.mac

  4. Get the switch arp table:

    Copy
    Copied!
                

    salt onyx1 net.arp

  5. Get switch information (uptime, vendor, os-version, etc):

    Copy
    Copied!
                

    salt onyx1 net.facts

  6. Get the switch interfaces details:

    Copy
    Copied!
                

    salt onyx1 net.interfaces

© Copyright 2023, NVIDIA. Last updated on Sep 8, 2023.