This document provides an overview of network automation using Ansible. It discusses: 1. What DevOps and NetDevOps are and why automation is important for avoiding repeated tasks and errors. 2. Ansible is introduced as an open source automation tool that is agentless, uses a push model, and has a simple architecture based on YAML files. 3. A case study is presented on how SBAC Bank used Ansible to automatically generate router configurations for new branches and manage routing policies across their network.
DevOps integrates developersand operations teams In order to improve collaboration and productivity by automating infrastructure, automating workflows and continuously measuring application performance Dev + Ops = DevOps DevOps
• Start with- - - • File extention .yml/.yaml • Easy for a human to read ANSIBLE Introduction YAML --- - hosts: ios-routers gather_facts: no connection: local tasks: - name: Save Configuration ios_command: commands: - write memory host: "{{ ansible_host }}"
14.
Hosts ANSIBLE Introduction • Listof devices or group of devices where ansible push configuration • Name and variable assign • Default location /etc/ansible/hosts • Can make your own
Module ANSIBLE Introduction • Modulescontrol system resources, packages, files. • Can be executed directly on remote hosts or through Playbooks • Over 450 ships with Ansible • User can also write their own modules
18.
ANSIBLE Introduction (Networkmodules) • asa_acl - Manage access-lists on a Cisco ASA • asa_command - Run arbitrary commands on Cisco ASA devices • eos_banner - Manage multiline banners on Arista EOS devices • eos_config - Manage Arista EOS configuration sections • bigip_command - Run arbitrary command on F5 devices. • bigip_hostname - Manage the hostname of a BIG-IP. • ios_banner - Manage multiline banners on Cisco IOS devices • ios_command - Run commands on remote devices running Cisco IOS • ios_config - Manage Cisco IOS configuration sections • iosxr_command - Run commands on remote devices running Cisco IOS XR • iosxr_config - Manage Cisco IOS XR configuration sections • junos_command - Run arbitrary commands on an Juniper JUNOS device • junos_config - Manage configuration on devices running Juniper JUNOS http://docs.ansible.com/ansible/list_of_network_modules.html
19.
Task ANSIBLE Introduction • Ata basic level, a task is nothing more than a call to an ansible module • Task run sequentially
20.
ANSIBLE Introduction tasksample - name: configure interface settings ios_config: lines: - description test interface - ip address 172.31.1.1 255.255.255.0 parents: interface Ethernet1 - name: load new acl into device ios_config: lines: - 10 permit ip host 1.1.1.1 any log - 20 permit ip host 2.2.2.2 any log parents: ip access-list extended test before: no ip access-list extended test match: exact
21.
Roles ANSIBLE Introduction • Ansibleroles are a special kind of playbook that are fully self-contained with tasks, variables, configuration templates and other supporting files • Has it’s own directory structure
ANSIBLE Security Ansible Vault •It keeps sensitive data such as password, keys, variable name in encrypted format • Need a password while encrypting, decrypting and running • ansible-vault is the keyword along with encrypt, decrypt, view, etc. parameter
Installing Ansible yum, rpm,apt-get, emerge, pkg, brew, github Python 2.6 or above for the control machine and python 2.X or later for managed node http://docs.ansible.com/ansible/latest/intro_installation.html
32.
How to run •ansible <inventory> -m • ansible-playbook • Ansible tower
33.
SBAC Case • Country:Bangladesh • Organization: SBAC Bank Limited • Branch: 61 • Customer: 80K • Journey start: April, 2013