SD-WAN Automation With Ansible
SD-WAN Automation With Ansible
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
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
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)
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
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
DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 10
Ansible terminology and analogies
• Playbook Script
• Role Function
• Task Instruction
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
cd sdwan-ansible-code
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
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
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/*"
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
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
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
DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 30
Bring automation into your network
DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 31
Continue Your Education
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
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
DEVWKS-1682 © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 36
Continue Your Education
Presentation ID © 2019 Cisco and/or its affiliates. All rights reserved. Cisco Public 37
Thank you
DEVWKS-1682