API Guide

Ansible inventory file
The inventory file contains the list of hosts on which you want to run commands. Ansible can run tasks on multiple hosts at the
same time.
Ansible playbooks use /etc/ansible/hosts as the default inventory file. To specify a different inventory file, use the -i
filepath command as an option when you run an Ansible playbook.
Ansible playbook file
Using playbooks, Ansible can configure multiple devices. Playbooks are human-readable scripts that are expressed in YAML
format. An Ansible playbook takes inventory and playbook files as arguments and maps the group of hosts in the inventory files
to the tasks listed in the playbook file.
Ansible variables
In Ansible, variables define switch configurations. Many Dell EMC switches have common configurations. Common configuration
variables are stored in the vars/main.yaml file; for example, dns_server and ntp_server. All host-specific
configurations are stored in the host_vars/host_name.yaml configuration file; for example, the hostname of a switch.
Variables are also used as part of playbook definitions, command-line arguments, and inventory definitions.
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:
Dell EMC Ansible Documentation
Dell EMC Networking Guides and search for Ansible
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
116
Dell EMC SmartFabric OS10 provisioning