Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.

Dell EMC SmartFabric OS10 User Guide Release 10.5.0

Example: Configure an OS10 switch using Ansible

OS10 supports Ansible integration to automate switch configuration. For detailed information about how to use Ansible scripts and create Ansible playbooks, go to: You can download auto-generated Ansible configuration files for the network design you provide from the Dell EMC Fabric Design Center.

Before you start

Before you configure an OS10 switch using Ansible, configure basic network settings on your switch, such as assigning an IP address and default gateway to the management interface:
  1. Connect a terminal emulator to the console serial port on the switch using a serial cable. The serial port settings are 115200, 8 data bits, and no parity.
  2. Configure the management interface; for example:
    OS10(config)# interface mgmt 1/1/1 
    OS10(conf-if-ma-1/1/1)# no ip address dhcp
    OS10(conf-if-ma-1/1/1)# ip address 10.1.1.10/24
    OS10(conf-if-ma-1/1/1)# no shutdown
    OS10(conf-if-ma-1/1/1)# exit
    OS10(config)# management route 10.10.20.0/24 10.1.1.1
    OS10(config)# end

Ansible configuration example

In this example, the configuration uses Ansible roles to configure an OS10 switch from an Ansible controller node with:
  • User name and password
  • NTP server
  • Syslog server
  1. Install Ansible on a controller node. You can find the latest version of Ansible on the Ansible Installation Guide page.

    You can run Ansible from any device with Python 2 (version 2.7) or Python 3 (version 3.5 or higher) installed, including Red Hat, Debian, Ubuntu, CentOS, OS X, any of the BSDs and so on.

    In this example, Ansible 2.7.12 is installed on an Ubuntu 16.04 virtual machine. To configure the Personal Package Archives (PPA) repository on the controller node and install Ansible, run these commands:
    sudo apt-get update
    sudo apt-get install software-properties-common
    sudo apt-add-repository --yes --update ppa:ansible/ansible
    sudo apt-get install ansible
    After you install Ansible, verify the version by entering:
    $ ansible --version
  2. Download and install Dell EMC Networking Ansible roles from the Ansible Galaxy web page; for example:
    $ ansible-galaxy install dell-networking.dellos-users
    $ ansible-galaxy install dell-networking.dellos-logging
    $ ansible-galaxy install dell-networking.dellos-ntp
  3. Create a directory to store inventory and playbook files; for example:
    $ mkdir AnsibleOS10
  4. Navigate to the directory and create an inventory file.
    $ cd AnsibleOS10/
    $ vim inventory.yaml
  5. Add the IP address and OS for each switch in the inventory.yaml file. Enter the command for each switch on one command line.
    OS10switch-1 ansible_host=192.168.1.203 ansible_network_os=dellos10 
    
    OS10switch-2 ansible_host=192.168.1.204 ansible_network_os=dellos10
  6. Create a host_vars directory to use for switch-specific variable files.
    $ mkdir host_vars
  7. Create a host variable file; for example, host_vars/OS10switch-1.yaml. Then define the host name and login credentials:
    $ vim host_vars/OS10switch-1.yaml
    
    hostname: OS10switch-1
    
    dellos_cfg_generate: True
    build_dir: /home/user/config
    ansible_ssh_user: admin
    ansible_ssh_pass: admin
    
    dellos_logging:
      logging:
      - ip: 1.1.1.1
        state: present
    
    dellos_users:
      - username: u1
        password: test@2468
        role: sysadmin
        privilege: 0
        state: present
    
    dellos_ntp:
      server:
      - ip: 3.3.3.3
    $ vim host_vars/OS10switch-2.yaml
    
    hostname: OS10switch-2
    
    dellos_cfg_generate: True
    build_dir: /home/user/config
    ansible_ssh_user: admin
    ansible_ssh_pass: admin
    
    dellos_logging:
      logging:
      - ip: 1.1.1.1
        state: present
    
    dellos_users:
      - username: u1
        password: Test@1347
        role: sysadmin
        privilege: 0
        state: present
    
    dellos_ntp:
      server:
      - ip: 3.3.3.3
    The dellos_cfg_generate parameter creates a local copy of the configuration commands applied to the remote switch on the Ansible controller node, and saves the commands in the directory defined in the build_dir path.
  8. Create a playbook file.
    $ vim playbook.yaml
    
    - hosts: OS10switch-1 OS10switch-2
      connection: network_cli
      roles:
        - dell-networking.dellos-logging
        - dell-networking.dellos-users
        - dell-networking.dellos-ntp
    To check the syntax of a playbook, use the ansible-playbook command with the --syntax-check flag. This command runs the playbook file through the parser to ensure that its included files, roles, and other parameters have no syntax problems.
  9. Run the playbook file. In the ansible-playbook command, the inventory and playbook files are mandatory entries. The play recap displays the results of the provisioning session; for example:
    $ ansible-playbook -i inventory.yaml playbook.yaml
    ...
    ...
    ...
    PLAY RECAP 
    ***************************************************************
    OS10switch-1: ok=7    changed=6    unreachable=0    failed=0
    OS10switch-2: ok=7    changed=6    unreachable=0    failed=0

Rate this content

Accurate
Useful
Easy to understand
Was this article helpful?
0/3000 characters
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please select whether the article was helpful or not.
  Comments cannot contain these special characters: <>()\