0% found this document useful (0 votes)
201 views39 pages

SD-WAN Automation With Ansible

Uploaded by

Salis Alvarez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views39 pages

SD-WAN Automation With Ansible

Uploaded by

Salis Alvarez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

DEVWKS-1682

SD-WAN Automation
with Ansible
Get started with Automation

Antonio Piepoli
Service Consulting Engineer
Agenda
• SD-WAN Introduction
• SD-WAN Configuration Management
• The story of a feature template
• Ansible Introduction
• It’s playbook time!

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 3
Let me introduce myself

Antonio Piepoli developer.cisco.com


[email protected] @CiscoDevNet
@anpiepoli facebook.com/ciscodevnet/
http://github.com/radtrentasei http://github.com/CiscoDevNet
DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 4
Set up
Connect the Any Connect

Set up the virtual environment

cd

source workspace/python/venv2/bin/activate

cd workspace/DEVWKS-1682/sdwan-ansible-code/code

Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 5
SDN applied to the WAN
vManage
Management/
APIs
Orchestration Plane
3rd Party
vAnalytics
Automation

vBond
Control Plane
vSmart Controllers

MPLS 4G

INET
vEdge Routers

Data Plane
Cloud Data Center Campus Branch SOHO

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 66
Three ways to manage the configuration

CLI Mode

CLI Templates

Feature and Device Templates

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 7
Build your configuration with templates

Feature templates
(more than 20 different features)

Device templates
(one for every type of branch)

Attach device template


(keep consistency across the network)

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 8
The story of a feature template
The ‘Hello world’ of SDWAN automation

Delete the Login


Banner feature template

Create a banner feature


Modify the banner template
Feature template

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 9
Tell me more about Ansible
• Open Source tool for configuration management

• Agentless

• Syntax based on YAML and Jinja templates

• Based on Python (easy to extend)

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 10
Ansible terminology and analogies
• Playbook  Script

• Role  Function

• Task  Instruction

• Inventory File Input data

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 11
-name: CiscoDevNet SDWAN Ansible Learning Lab 1
hosts: all site.yml
connection: local
gather_facts: no
roles:
- role: login
tags: login,create,modify,delete playbooks/learning_lab_1.yml
- role: create_banner_template
tags: create
vars:
- Template_Name: 'DevNetSandbox'
- Template_Description: 'Description'
- Login_Banner: 'You are welcome'
- MOTD: 'You are welcome'
- role: modify_banner_template
tags: modify
vars:
- Template_Name: 'DevNetSandbox'
- Template_Description: 'Description'
- Login_Banner: 'You are very very welcome'
- MOTD: 'You are very very welcome'
- role: delete_banner_template
tags: delete
vars:
- Template_Name: 'DevNetSandbox'

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 12
A quick look at the Inventory file
Inventory.yml

all:
hosts:
vManage:
ansible_host: 10.10.20.90
ansible_port: 8443
username: admin
password: admin

Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 13
It’s playbook time #0

git clone https://github.com/CiscoDevNet/sdwan-ansible-code.git

cd sdwan-ansible-code

pip install -r requirements.txt


DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 14
It’s playbook time #1

ansible-playbook site.yml -i inventories/inventory.yml

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 15
Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 16
It’s playbook time #2

ansible-playbook site.yml -i inventories/inventory.yml –t login

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 17
- name: Login to the vManage
uri:
url: https://{{ansible_host}}:{{ansible_port}}/dataservice/j_security_check
method: POST
body: "j_username={{username}}&j_password={{password}}"
validate_certs: no
headers:
Content-Type: "application/x-www-form-urlencoded"
register: login

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 18
Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 19
It’s playbook time #3

ansible-playbook site.yml -i inventories/inventory.yml –t create

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 20
- name: Clean Rendered Templates
file:
path: "{{item}}"
state: absent
force: true
with_fileglob:
- "{{role_path}}/files/*"

- name: Render Template


template: src="BANNER_MASTER_TEMPLATE.j2" dest={{role_path}}/files/{{ Template_Name }}.json

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 21
- name: Create Feature Template
uri:
url: https://{{ansible_host}}:{{ansible_port}}/dataservice/template/feature
method: POST
validate_certs: no
body: "{{lookup('file', '{{item}}')}}"
body_format: json
headers:
Cookie: "{{login.set_cookie}}"
Content-Type: "application/json"
with_fileglob:
- "{{ role_path }}/files/*.json"

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 21
Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 23
It’s playbook time #4

ansible-playbook site.yml -i inventories/inventory.yml –t modify

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 24
DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 25
Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 26
It’s playbook time #5

ansible-playbook site.yml -i inventories/inventory.yml –t delete

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 27
DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 28
Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 29
The story of a feature template
The ‘Hello world’ of SDWAN automation

Delete the Login


Banner feature template

Create a banner feature


Modify the banner template
Feature template

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 30
Bring automation into your network

Save all your feature templates in a repository to track changes

Link your service catalog to automated workflows

Start an automatic troubleshooting workflows

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
Continue Your Education

Demos in Meet the Related


Walk-in
the Cisco engineer sessions
self-paced
Showcase labs 1:1
meetings

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 32
Cisco DevNet Code Exchange
Share your code
Build your developer cred

Get your code in front of the DevNet Community

developer.cisco.com/codeexchange
#CLEUR #DevNet
© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 33
’’The first rule of any technology used in a business is that automation applied
to an efficient operation will magnify the efficiency.
The second is that automation applied to an inefficient operation will magnify
the inefficiency.’’

Bill Gates

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 34
Cisco Webex Teams

Questions?
Use Cisco Webex Teams (formerly Cisco Spark)
to chat with the speaker after the session

How
1 Find this session in the Cisco Events Mobile App
2 Click “Join the Discussion”
3 Install Webex Teams or go directly to the team space
4 Enter messages/questions in the team space

cs.co/ciscolivebot#DEVWKS-1682

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 35
Complete your online
session survey
• Please complete your Online Session
Survey after each session
• Complete 4 Session Surveys & the Overall
Conference Survey (available from
Thursday) to receive your Cisco Live T-
shirt
• All surveys can be completed via the Cisco
Events Mobile App or the Communication
Stations

Don’t forget: Cisco Live sessions will be available for viewing


on demand after the event at ciscolive.cisco.com

DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
Continue Your Education

Demos in Meet the Related


Walk-in
the Cisco engineer sessions
self-paced
Showcase labs 1:1
meetings

Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 37
Thank you
DEVWKS-1682

You might also like