SlideShare a Scribd company logo
Network Automation
with Ansible
Anas Tarsha
Bay Area Network Operators Group (BANOG)
Anas Tarsha
• Network/Cloud Architect, CCIE
• Areas of focus: data center, cloud, and network
automation
• BANOG founder & organizer
• Follow me on Twitter @AnasTarsha
• Blog: AnasTarsha.com
Agenda
• About Ansible
• Use Cases
• How Ansible Works?
• Install Ansible
• Run Ansible
• Live Demos
What Is Ansible?
• IT Automation and configuration management tool
• Emerged in 2012 to initially deploy Linux
applications; support for networking modules was
added in release 2.x
• Open source; code available on Github
• Often compared to Chef, Puppet, and SaltStack
Why Ansible?
• Agentless and extensible
• You don’t need to be a programmer to get started
• Saves time (maybe)
• Speed, but do you care?
• Predictable outcome; reduces human error
Ansible Use Cases
• Generating device configurations
• Saving and collecting running device
configurations
• Pushing out configurations to the network
• Upgrading devices
How Does Ansible Work?
Ansible
Control Host
Inventory File
sw1
r1
fw1
Network
Device
Playbook
play 1
hosts: all
- task 1
- task 2
SSH
Netconf
eAPI
NX-API
Python code
executed here
Install Ansible
• Easy to install using utilities like pip, yum, apt
• Runs only on Linux-based machines
• Official Install Guide:
http://docs.ansible.com/ansible/intro_installation.html
Ansible Playbooks
• Describe a policy you want to enforce or tasks you want o execute on your
devices
• Expressed in YAML
• “We use YAML because it is easier for humans to read and write than other
common data formats like XML or JSON” — ansible.com
• Each playbook can have a play or more and each play can have one task or more
• Tasks are executed sequentially
- name: example playbook
hosts: junos
tasks:
- tasks you want to automate
Ansible Modules
• They do the actual work in playbook; take arguments
• Mostly written in Python and return JSON data
• Core modules come installed with Ansible; non-core modules can be installed manually
• Run in playbook, but can run single module from command line
• Use ansible-doc module_name command for help
• Ansible Networking Modules http://docs.ansible.com/ansible/list_of_network_modules.html
• Example:
- name: collect default set of facts and configuration in XML & JSON format
junos_facts:
config: yes
config_format: xml
Run Ansible
1. Create an inventory file and define your devices:
[ios]
router1 ansible_host=192.168.0.201
switch1 ansible_host=192.168.0.203
[junos]
router2 ansible_host=192.168.0.130
2. Create a playbook:
- name: ping Google’s DNS from the device
hosts: ios
tasks:
- ios_command:
commands: ping 8.8.8.8
….. <omitted>
3. Run the playbook: ansible-playbook myPlaybook.yml
Sample inventory file:
2 groups, total of 3
network devices defined
Sample playbook:
Include plays and tasks
to execute
Live Demos
• Vagrant running on macOS Sierra to provision the
host VM
• Ansible 2.2 running on Ubuntu 14.4 LTS
• Cisco CSR 1000v and Juniper vSRX
• SSH is enabled on CSR; Netconf is enabled on
vSRX
Demo 1: Ping Module
# ansible all -m ping
vsrx | SUCCESS => {
"changed": false,
"ping": "pong"
}
csr | SUCCESS => {
"changed": false,
"ping": "pong"
}
Demo 2: show_arp.yml
---
- hosts: ios
tasks:
- ios_command:
commands: show arp
host: csr
username: cisco
password: cisco
transport: cli
ios_command module
with required parameters
Demo 3:
show_arp_result.yml
---
- hosts: ios
tasks:
- ios_command:
commands: show arp
host: csr
username: cisco
password: cisco
transport: cli
register: result
- debug: var=result
Demo 4:
change_hostname.yml
---
- name: Change hostname on a Cisco IOS router
hosts: ios
tasks:
- ios_config:
commands:
- hostname CSR1
provider: "{{ cli }}"
ios_config module with
required arguments
Demo 5:
show_arp_result_junos.yml
---
- hosts: junos
tasks:
- junos_command:
commands: show arp
provider: "{{ netconf }}"
register: result
- debug: var=result
junos module with
required arguments
Additional Resources
• Network Automation with Ansible, report by Jason Edelman (free,
login required)
https://www.oreilly.com/learning/network-automation-with-ansible
• Up and Running with Ansible (free eBook)
https://ipfs.io/ipfs/
QmTJaLdhUW6jTdXGFoqv7wZe5KguBi5F2u4ihBdrUMVPhw
• Ivan Pepeljak’s Blog http://ipspace.net
• Learn Linux: video training from safaribooksonline.com or
lynda.com or pluralsight.com
Thank You
Stay in touch
Questions?
Ad

More Related Content

What's hot (20)

Ansible
AnsibleAnsible
Ansible
Rahul Bajaj
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
sriram_rajan
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
Suresh Kumar
 
Network automation (NetDevOps) with Ansible
Network automation (NetDevOps) with AnsibleNetwork automation (NetDevOps) with Ansible
Network automation (NetDevOps) with Ansible
Bangladesh Network Operators Group
 
NGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX: Basics and Best Practices
NGINX: Basics and Best Practices
NGINX, Inc.
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
Martin Danielsson
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
Stephane Manciot
 
Ansible 101
Ansible 101Ansible 101
Ansible 101
Gena Mykhailiuta
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
John Lynch
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
Bas Meijer
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
Eueung Mulyana
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
Knoldus Inc.
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
Yashar Esmaildokht
 
Kubernetes
KubernetesKubernetes
Kubernetes
erialc_w
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
fazalraja
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101
APNIC
 
[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기
[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기
[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기
OpenStack Korea Community
 
OpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image LifecycleOpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image Lifecycle
Mihai Criveti
 
Ansible
AnsibleAnsible
Ansible
Vishal Yadav
 
DevOps with Ansible
DevOps with AnsibleDevOps with Ansible
DevOps with Ansible
Swapnil Jain
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
sriram_rajan
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
Suresh Kumar
 
NGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX: Basics and Best Practices
NGINX: Basics and Best Practices
NGINX, Inc.
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
John Lynch
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
Bas Meijer
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
Knoldus Inc.
 
Kubernetes
KubernetesKubernetes
Kubernetes
erialc_w
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
fazalraja
 
Network Automation: Ansible 101
Network Automation: Ansible 101Network Automation: Ansible 101
Network Automation: Ansible 101
APNIC
 
[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기
[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기
[OpenInfra Days Korea 2018] (Track 3) Zuul v3 - OpenStack 인프라 코드로 CI/CD 살펴보기
OpenStack Korea Community
 
OpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image LifecycleOpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image Lifecycle
Mihai Criveti
 
DevOps with Ansible
DevOps with AnsibleDevOps with Ansible
DevOps with Ansible
Swapnil Jain
 

Viewers also liked (20)

Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
Martin Etmajer
 
Juniper Network Automation for KrDAG
Juniper Network Automation for KrDAGJuniper Network Automation for KrDAG
Juniper Network Automation for KrDAG
KwonSun Bae
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
APNIC
 
Ansible Case Studies
Ansible Case StudiesAnsible Case Studies
Ansible Case Studies
Greg DeKoenigsberg
 
Routing Management with MIRA and enhancement (IMECS2010)
Routing Management with MIRA and enhancement (IMECS2010)Routing Management with MIRA and enhancement (IMECS2010)
Routing Management with MIRA and enhancement (IMECS2010)
Akhmad Zaimi
 
Better Network Management Through Network Programmability
Better Network Management Through Network ProgrammabilityBetter Network Management Through Network Programmability
Better Network Management Through Network Programmability
Cisco Canada
 
Ansible with-junos
Ansible with-junosAnsible with-junos
Ansible with-junos
Akhmad Zaimi
 
Extending ansible
Extending ansibleExtending ansible
Extending ansible
Yan Kurniawan
 
Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)
Alejandro Salinas
 
Ansible & Vagrant
Ansible & VagrantAnsible & Vagrant
Ansible & Vagrant
Mukul Malhotra
 
Flexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-AnsibleFlexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-Ansible
Major Hayden
 
Managing sensitive data with Ansible vault
Managing sensitive data with Ansible vaultManaging sensitive data with Ansible vault
Managing sensitive data with Ansible vault
Pascal Stauffer
 
Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network Automation
Rick Sherman
 
Ansible for Enterprise
Ansible for EnterpriseAnsible for Enterprise
Ansible for Enterprise
Ansible
 
[세미나] Vagrant 이지원
[세미나] Vagrant 이지원[세미나] Vagrant 이지원
[세미나] Vagrant 이지원
지원 이
 
OpenStack-Ansible Security
OpenStack-Ansible SecurityOpenStack-Ansible Security
OpenStack-Ansible Security
Major Hayden
 
netconf, restconf, grpc_basic
netconf, restconf, grpc_basicnetconf, restconf, grpc_basic
netconf, restconf, grpc_basic
Gyewan An
 
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
승엽 신
 
Ansible과 CloudFormation을 이용한 배포 자동화
Ansible과 CloudFormation을 이용한 배포 자동화Ansible과 CloudFormation을 이용한 배포 자동화
Ansible과 CloudFormation을 이용한 배포 자동화
AWSKRUG - AWS한국사용자모임
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
Mukul Malhotra
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
Martin Etmajer
 
Juniper Network Automation for KrDAG
Juniper Network Automation for KrDAGJuniper Network Automation for KrDAG
Juniper Network Automation for KrDAG
KwonSun Bae
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
APNIC
 
Routing Management with MIRA and enhancement (IMECS2010)
Routing Management with MIRA and enhancement (IMECS2010)Routing Management with MIRA and enhancement (IMECS2010)
Routing Management with MIRA and enhancement (IMECS2010)
Akhmad Zaimi
 
Better Network Management Through Network Programmability
Better Network Management Through Network ProgrammabilityBetter Network Management Through Network Programmability
Better Network Management Through Network Programmability
Cisco Canada
 
Ansible with-junos
Ansible with-junosAnsible with-junos
Ansible with-junos
Akhmad Zaimi
 
Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)
Alejandro Salinas
 
Flexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-AnsibleFlexible, simple deployments with OpenStack-Ansible
Flexible, simple deployments with OpenStack-Ansible
Major Hayden
 
Managing sensitive data with Ansible vault
Managing sensitive data with Ansible vaultManaging sensitive data with Ansible vault
Managing sensitive data with Ansible vault
Pascal Stauffer
 
Python (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network AutomationPython (Jinja2) Templates for Network Automation
Python (Jinja2) Templates for Network Automation
Rick Sherman
 
Ansible for Enterprise
Ansible for EnterpriseAnsible for Enterprise
Ansible for Enterprise
Ansible
 
[세미나] Vagrant 이지원
[세미나] Vagrant 이지원[세미나] Vagrant 이지원
[세미나] Vagrant 이지원
지원 이
 
OpenStack-Ansible Security
OpenStack-Ansible SecurityOpenStack-Ansible Security
OpenStack-Ansible Security
Major Hayden
 
netconf, restconf, grpc_basic
netconf, restconf, grpc_basicnetconf, restconf, grpc_basic
netconf, restconf, grpc_basic
Gyewan An
 
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
XE 모듈 개발 - 걸음마부터 날기까지 - 달리기
승엽 신
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
Mukul Malhotra
 
Ad

Similar to Network Automation with Ansible (20)

Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
Mehmet Ali Aydın
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
NigussMehari4
 
Ansible presentation of cil for education prepare
Ansible presentation of cil for education prepareAnsible presentation of cil for education prepare
Ansible presentation of cil for education prepare
yadharuvsp
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Idan Tohami
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Idan Tohami
 
SESSION Ansible how to deploy and push resources
SESSION Ansible how to deploy and push resourcesSESSION Ansible how to deploy and push resources
SESSION Ansible how to deploy and push resources
Saravanan68713
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
Ansible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-presAnsible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-pres
Manmohan Singh
 
Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL Meetup
Jeff Geerling
 
Ansiblefest 2018 Network automation journey at roblox
Ansiblefest 2018 Network automation journey at robloxAnsiblefest 2018 Network automation journey at roblox
Ansiblefest 2018 Network automation journey at roblox
Damien Garros
 
06 network automationwithansible
06 network automationwithansible06 network automationwithansible
06 network automationwithansible
Khairul Zebua
 
Ansible.pdf
Ansible.pdfAnsible.pdf
Ansible.pdf
shaikshazil1
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshop
David Karban
 
Automating Yourself Out of Trouble
Automating Yourself Out of TroubleAutomating Yourself Out of Trouble
Automating Yourself Out of Trouble
Jose De La Rosa
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
Richard Donkin
 
Ansible Network Automation session1
Ansible Network Automation session1Ansible Network Automation session1
Ansible Network Automation session1
Dhruv Sharma
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
Osama Mustafa
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
Richard Donkin
 
Kubernetes for HCL Connections Component Pack - Build or Buy?
Kubernetes for HCL Connections Component Pack - Build or Buy?Kubernetes for HCL Connections Component Pack - Build or Buy?
Kubernetes for HCL Connections Component Pack - Build or Buy?
Martin Schmidt
 
No Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with AnsibleNo Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with Ansible
Jeff Potts
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
NigussMehari4
 
Ansible presentation of cil for education prepare
Ansible presentation of cil for education prepareAnsible presentation of cil for education prepare
Ansible presentation of cil for education prepare
yadharuvsp
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Idan Tohami
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Idan Tohami
 
SESSION Ansible how to deploy and push resources
SESSION Ansible how to deploy and push resourcesSESSION Ansible how to deploy and push resources
SESSION Ansible how to deploy and push resources
Saravanan68713
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
Ansible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-presAnsible nice-pdf-copy-for-pres
Ansible nice-pdf-copy-for-pres
Manmohan Singh
 
Ansible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL MeetupAnsible 101 - Presentation at Ansible STL Meetup
Ansible 101 - Presentation at Ansible STL Meetup
Jeff Geerling
 
Ansiblefest 2018 Network automation journey at roblox
Ansiblefest 2018 Network automation journey at robloxAnsiblefest 2018 Network automation journey at roblox
Ansiblefest 2018 Network automation journey at roblox
Damien Garros
 
06 network automationwithansible
06 network automationwithansible06 network automationwithansible
06 network automationwithansible
Khairul Zebua
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshop
David Karban
 
Automating Yourself Out of Trouble
Automating Yourself Out of TroubleAutomating Yourself Out of Trouble
Automating Yourself Out of Trouble
Jose De La Rosa
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
Richard Donkin
 
Ansible Network Automation session1
Ansible Network Automation session1Ansible Network Automation session1
Ansible Network Automation session1
Dhruv Sharma
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
Richard Donkin
 
Kubernetes for HCL Connections Component Pack - Build or Buy?
Kubernetes for HCL Connections Component Pack - Build or Buy?Kubernetes for HCL Connections Component Pack - Build or Buy?
Kubernetes for HCL Connections Component Pack - Build or Buy?
Martin Schmidt
 
No Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with AnsibleNo Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with Ansible
Jeff Potts
 
Ad

Recently uploaded (20)

UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 

Network Automation with Ansible

  • 1. Network Automation with Ansible Anas Tarsha Bay Area Network Operators Group (BANOG)
  • 2. Anas Tarsha • Network/Cloud Architect, CCIE • Areas of focus: data center, cloud, and network automation • BANOG founder & organizer • Follow me on Twitter @AnasTarsha • Blog: AnasTarsha.com
  • 3. Agenda • About Ansible • Use Cases • How Ansible Works? • Install Ansible • Run Ansible • Live Demos
  • 4. What Is Ansible? • IT Automation and configuration management tool • Emerged in 2012 to initially deploy Linux applications; support for networking modules was added in release 2.x • Open source; code available on Github • Often compared to Chef, Puppet, and SaltStack
  • 5. Why Ansible? • Agentless and extensible • You don’t need to be a programmer to get started • Saves time (maybe) • Speed, but do you care? • Predictable outcome; reduces human error
  • 6. Ansible Use Cases • Generating device configurations • Saving and collecting running device configurations • Pushing out configurations to the network • Upgrading devices
  • 7. How Does Ansible Work? Ansible Control Host Inventory File sw1 r1 fw1 Network Device Playbook play 1 hosts: all - task 1 - task 2 SSH Netconf eAPI NX-API Python code executed here
  • 8. Install Ansible • Easy to install using utilities like pip, yum, apt • Runs only on Linux-based machines • Official Install Guide: http://docs.ansible.com/ansible/intro_installation.html
  • 9. Ansible Playbooks • Describe a policy you want to enforce or tasks you want o execute on your devices • Expressed in YAML • “We use YAML because it is easier for humans to read and write than other common data formats like XML or JSON” — ansible.com • Each playbook can have a play or more and each play can have one task or more • Tasks are executed sequentially - name: example playbook hosts: junos tasks: - tasks you want to automate
  • 10. Ansible Modules • They do the actual work in playbook; take arguments • Mostly written in Python and return JSON data • Core modules come installed with Ansible; non-core modules can be installed manually • Run in playbook, but can run single module from command line • Use ansible-doc module_name command for help • Ansible Networking Modules http://docs.ansible.com/ansible/list_of_network_modules.html • Example: - name: collect default set of facts and configuration in XML & JSON format junos_facts: config: yes config_format: xml
  • 11. Run Ansible 1. Create an inventory file and define your devices: [ios] router1 ansible_host=192.168.0.201 switch1 ansible_host=192.168.0.203 [junos] router2 ansible_host=192.168.0.130 2. Create a playbook: - name: ping Google’s DNS from the device hosts: ios tasks: - ios_command: commands: ping 8.8.8.8 ….. <omitted> 3. Run the playbook: ansible-playbook myPlaybook.yml Sample inventory file: 2 groups, total of 3 network devices defined Sample playbook: Include plays and tasks to execute
  • 12. Live Demos • Vagrant running on macOS Sierra to provision the host VM • Ansible 2.2 running on Ubuntu 14.4 LTS • Cisco CSR 1000v and Juniper vSRX • SSH is enabled on CSR; Netconf is enabled on vSRX
  • 13. Demo 1: Ping Module # ansible all -m ping vsrx | SUCCESS => { "changed": false, "ping": "pong" } csr | SUCCESS => { "changed": false, "ping": "pong" }
  • 14. Demo 2: show_arp.yml --- - hosts: ios tasks: - ios_command: commands: show arp host: csr username: cisco password: cisco transport: cli ios_command module with required parameters
  • 15. Demo 3: show_arp_result.yml --- - hosts: ios tasks: - ios_command: commands: show arp host: csr username: cisco password: cisco transport: cli register: result - debug: var=result
  • 16. Demo 4: change_hostname.yml --- - name: Change hostname on a Cisco IOS router hosts: ios tasks: - ios_config: commands: - hostname CSR1 provider: "{{ cli }}" ios_config module with required arguments
  • 17. Demo 5: show_arp_result_junos.yml --- - hosts: junos tasks: - junos_command: commands: show arp provider: "{{ netconf }}" register: result - debug: var=result junos module with required arguments
  • 18. Additional Resources • Network Automation with Ansible, report by Jason Edelman (free, login required) https://www.oreilly.com/learning/network-automation-with-ansible • Up and Running with Ansible (free eBook) https://ipfs.io/ipfs/ QmTJaLdhUW6jTdXGFoqv7wZe5KguBi5F2u4ihBdrUMVPhw • Ivan Pepeljak’s Blog http://ipspace.net • Learn Linux: video training from safaribooksonline.com or lynda.com or pluralsight.com
  • 19. Thank You Stay in touch Questions?