Chapter 1 What is Network Automation?

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 24

Framework

Think of Ansible more as an automation framework rather than a programming language. Ansible is not C++ or Java for networks but rather a framework of tools made up of the following:

 Inventory:

o Static hosts.ini file. o Possibly dynamic using API calls to NMS, IPAM, or inventory system already maintained

with a list of network devices.  Variables:

o group_vars. o host_vars. o YAML format. o Data models for network devices as a group and as individual devices.

 Playbooks:

o YAML file format. o Serial execution of tasks. o Calls Ansible modules.

 Templates:

o Jinja2 file format. o Dynamic calls to the variables at playbook run time. o Mix of static text, simple logic (“if”, “else”, “for”), and variables.

 Plug-ins:

o Python format. o Extend base capabilities of core Ansible engine. o Custom written.

 Modules:

o Python and PowerShell format. o Vendor specific modules for communicating with devices.

Python Python (https://www.python.org/) is a powerful, easy to learn, open source programming language and is the foundation for Ansible. Created by Guido van Rossum and released in 1991 Python has a design philosophy of readability. The Ansible repository is available at GitHub (https://github.com/ansible/ansible/) and it is possible to contribute to the community project. While it is not necessary to understand the Python code Ansible is written in, it is possible to write Ansible plug-ins using Python or contribute code to the Ansible project once Python is well understood.

YAML

YAML Ain't Markup Language (http://yaml.org/) (https://github.com/yaml/) is a human-readable data serialization language commonly used for configuration files. YAML was created by Clark Evans who designed it together with Ingy döt Net and Oren Ben-Kiki in 2001. Most of the Ansible files, including