SlideShare a Scribd company logo
1 of 54
Download to read offline
www.anm.com
Ansible:
Server and Network Device
Automation
Klaus Mueller & Ian Logan
www.anm.com
June 8, 2018
www.anm.com
Who we are
Klaus Mueller
Senior Solutions Architect, ANM
• Route/Switch CCIE #5450
• 30+ years experience in IT
• 20 years experience working with
State/Local, Healthcare, Education,
and Commercial in New Mexico
• Specialize in campus and data
center networks
Ian Logan
Senior Solutions Architect, ANM
• 20 years at NMSU
– Data center architecture
– Private networks for energy
management systems
– Unix & Linux systems administration
• Specialize in data center
virtualization and automation
www.anm.comwww.anm.com
ANM is headquartered in
Albuquerque, NM and
operates in Colorado,
Texas and New Mexico. In
addition to Albuquerque,
ANM has offices in
Denver (CO),
Colorado Springs (CO)
and El Paso (TX).
www.anm.com
Evolution of Network Configuration
First Cisco Router
1986
Latest Cisco Router
2018
CLI via console
and Telnet
CLI via console
and SSH
www.anm.com
There are tools…
… but they are costly and frustrating
…and often go un-/under-used
www.anm.com
…and old habits die hard…
Notepad
Copy &
Paste
www.anm.com
Meanwhile in Servers…
Server Virtualization
Linux
DevOps
Chef/Puppet
PowerShell
Cloud
vRA
Technologies
Methodologies
Tools
Open Source
www.anm.com
To be fair…
Data Center Network Fabrics
Cisco ACI VMware NSX
Software Defined Networks
Network Function Virtualization (NFV)
Network Programmability
APIs and Standards
NetDevOps
“Infrastructure as Code”
www.anm.com
More on “Software Defined”
Software Defined Networks
Many approaches:
• Controller-based, centralized data plane (e.g.
OpenFlow)
• Central policy engine (e.g. Cisco ACI)
Focus has been on data center – ACI, Vmware NSX
Evolving to WAN (SD-WAN – e.g. Viptela, Riverbed),
and Access (SD-Access – e.g. Cisco Digital Network
Architecture, aka DNA)
Very promising, still early in adoption in most orgs.
www.anm.com
“The Holy Grail”
Be like Facebook
Automatically
deploy a fully
populated rack
of servers and
network gear
with minimal
intervention.
Or somewhere in between…
• Standardized configs
• Automated deployment
• Push changes quickly
• Automate repetitive tasks
www.anm.com
Network Engineers need new skills
www.anm.com
• Python
– Scripting
• Linux (or Mac OS X)
– Using open-source tools
• Templating
– Jinja
• Programmability
– REST APIs
– YAML, JSON, XML
– NETCONF
• Data Models
– YANG
Network Engineers need new skills
www.anm.com
“DevOps Tools”
can help bridge the gap
• Automation
– Configuration
deployment and
management
• Open Source
• Community Driven
• Many learning
resources
• Chef and Puppet
– Agent-based
• Ansible and Salt
– Agent-less
www.anm.com
• Agent-less
• Works well for both
network and servers
• Idempotent
configuration
management
• Modular framework
• Supported by Red Hat
• Works with templates
and variables
• Communicates over
SSH
• Simple templating
language (Playbooks =
YAML)
Ansible – “The Easier Button”
www.anm.com
Ansible
Deep Dive
www.anm.com
Ansible – Deep dive
How would you describe Ansible in one
sentence?
• A tool for expressing the desired state of a
system at a high level.
www.anm.com
Ansible – Deep dive
• Ansible plays nicely with just about everyone!
www.anm.com
Ansible – Deep dive
• Requirements for installing Ansible
– Python 2.6/2.7 or 3.5 and newer
– A Unix like system to act as the control machine
www.anm.com
Ansible – Deep dive
Playbook
Ansible
Engine
Managed
Node
SSH
• Inventory Host File
• API
• Modules
• Password Vault
• Unix/Linux/Windows
• Cisco IOS/NXOS/ACI
• vSphere
• And many more…
• A YAML doc
• Living MOP
www.anm.com
Ansible – Deep dive
• Choices on installing Ansible
– Vendor packages or Python pip
– Packages might be a little stale but ease of
maintenance is probably worth it.
www.anm.com
Ansible – Deep dive
• We’ll use CENTOS 7.5 for our examples.
• Its that easy.
www.anm.com
Ansible – Deep dive
• Ansible’s master config file – ansible.cfg
ANSIBLE_CONFIG
Env. variable
ansible.cfg
Incurrent
directory
$HOME/.ansible.cfg /etc/ansible/ansible.cfg
The first one found wins
www.anm.com
Ansible – Deep dive
We’ll take all the defaults except for 2 lines
www.anm.com
Ansible – Deep dive
Ansible’s inventory system:
• A simple text file.
• Dynamic inventory from AWS, OpenStack, etc.
• You can use both simultaneously.
www.anm.com
Ansible – Deep dive
Ansible host file:
• INI style formatting
• Group names are in []
• Hosts can belong to
multiple groups
• Groups can be nested
www.anm.com
Ansible – Deep dive
Linux demo environment:
– Precreated a user named “ansible” on each
machine
– SSH authorized_keys configuration
– Added sudo configuration for the ansible user
– These steps are all optional, but they make the
demo easier.
www.anm.com
Ansible – Deep dive
Ansible one liners for Linux:
www.anm.com
Ansible – Deep dive
Ansible facts & variables:
• Facts are variables that describe the system
being managed
• Facts can be automatically gathered
• You reference a variable with “{{ variable }}”
www.anm.com
Ansible – Deep dive
Ansible facts & variables:
• You can get all of the facts for a device with a
one liner
– ansible ios-devices -c network_cli -m ios_facts
– ansible linux -m setup
www.anm.com
Ansible – Deep dive
• Gathering facts
takes a while
• On a Linux host it
there are over 100
facts
• Output from many one liners will be in JSON
www.anm.com
Ansible – Deep dive
Ansible playbooks:
• Playbooks are our tool for automating
complex tasks.
• Playbooks also allow us to express
orchestration across multiple managed nodes.
• They’re written as YAML documents.
www.anm.com
Ansible – Deep dive
YAML:
• Indentation matters!!
– Indent to group related items
• # begins a comment
• - - - begins a YAML document
• - to denote list elements
www.anm.com
Ansible – Deep dive
A sample playbook:
• Hosts: the target nodes
• Become* do we need
elevated privileges?
• Tasks: list of things to do
– We call these plays
• Yum is an ansible module
– Name: httpd – a RPM name
– State: present or absent
www.anm.com
Ansible – Deep dive
Running a playbook:
www.anm.com
Ansible – Deep dive
Playbooks can be executable scripts:
• Add a “#!/usr/bin/ansible-playbook” as the
first line
• Make the file executable
www.anm.com
Ansible – Deep dive
Lets get rid of Apache:
www.anm.com
Ansible – Deep dive
One more Linux playbook:
• One play with two tasks
www.anm.com
Ansible – Deep dive
www.anm.com
Ansible – Deep dive
Lets look at a Network playbook:
• Inventory_hostname is a builtin variable
www.anm.com
Ansible – Deep dive
{{ inventory_hostname }} is replaced with the
name of the current node
www.anm.com
Ansible – Deep dive
• We can iterate across
lists with items
• Parents are how we
change the config
context for IOS
www.anm.com
Ansible – Deep dive
www.anm.com
Ansible – Deep dive
Make sure you write the entire command!
– Ios_config module makes comparisons between
the playbook and the running config.
– If its not an exact match, the command is
executed at every run.
www.anm.com
Ansible – Deep dive
We’re not using SSH keys to login to the router,
where’s the password?
• We can store the password in a variable.
• Variables can be stored in encrypted files
called vaults.
www.anm.com
Ansible – Deep dive
How do we organize per host or group
variables?
• We can put them in the playbook itself.
• We can create host/group variables in the
host_vars/group_vars directory.
– One file for each host/group.
www.anm.com
Ansible – Deep dive
Host variables for an IOS device
• Ansible_connection: network_cli removes the
need for python on the node
• Ansible_network_os: ios, vyos, junos, etc.
• Ansible_ssh_pass: the login password
www.anm.com
Choosing What to Automate
www.anm.com
DevOps: “The 3 Ways”
via Gene Kim, et al
see “The Phoenix Project”
and “The DevOps Handbook”
www.anm.com
E.g. Use Cases
• Regular, repetitive tasks
• Large-scale infrequent tasks
– pushing config changes to large
number of devices
• In-frequent tasks that require
consistency
– e.g. device deployment
• Building Flow: Theory of
Constraints
– manual tasks that take a long
time that can be automated
• Pushing configs to multiple
device
• Templatizing config changes
• Automating config changes
• Automating deployments
• Reporting and compliance
www.anm.com
What Next?
Resources
www.anm.com
Books
www.anm.com
Websites
• Ansible Website: www.ansible.com
– Documentation, Quick Start videos, Tutorials
• Cisco DevNet: developer.cisco.com
– Free login
– Free training
• "Network Programmability for Network Engineers”
• Ansible videos and learning labs
www.anm.com
Links
• Ansible.com
– Documentation and Quick Start videos:
docs.ansible.com
• Developer.cisco.com
– ”Introduction to Ansible”
https://learninglabs.cisco.com/lab/ansible-02_ansible-intro/step/1
– “NetDevOps” videos – Ansible for Cisco configuration management
https://developer.cisco.com/video/net-prog-basics/05-netdevops
– “Getting Hands on with Ansible” Learning Lab
https://learninglabs.cisco.com/lab/ansible-03_ansible-hands-on/step/1
www.anm.com
Contact Us
• See us at ANM table in the Vendor Fair
– Demo capability
• Email us:
– Klaus.Mueller@anm.com
– Ian.Logan@anm.com
• https://www.slideshare.net/klausternm
• www.anm.com

More Related Content

What's hot

Using Aws As A Game Server (AWS UG Bandung)
Using Aws As A Game Server (AWS UG Bandung)Using Aws As A Game Server (AWS UG Bandung)
Using Aws As A Game Server (AWS UG Bandung)Aswin Juari
 
Sympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMSSympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMSJonathan Wage
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on RailsAvi Kedar
 
Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UKRicard Clau
 
Deploying PHP Applications with Ansible
Deploying PHP Applications with AnsibleDeploying PHP Applications with Ansible
Deploying PHP Applications with AnsibleOrestes Carracedo
 
Scaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkScaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkLushen Wu
 
Server Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsServer Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsJeff Geerling
 
WP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealWP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealShawn Hooper
 
Chef + AWS + CodeIgniter
Chef + AWS + CodeIgniterChef + AWS + CodeIgniter
Chef + AWS + CodeIgniterciconf
 
eMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseeMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseScott Taylor
 
[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReaders
[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReaders[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReaders
[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReadersRakuten Group, Inc.
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerDennis Rowe
 
Ansible Berlin Meetup Intro talk by @danvaida
Ansible Berlin Meetup Intro talk by @danvaidaAnsible Berlin Meetup Intro talk by @danvaida
Ansible Berlin Meetup Intro talk by @danvaidaDan Vaida
 
Going Serverless with OpenWhisk
Going Serverless with OpenWhiskGoing Serverless with OpenWhisk
Going Serverless with OpenWhiskRaymond Camden
 

What's hot (20)

Using Aws As A Game Server (AWS UG Bandung)
Using Aws As A Game Server (AWS UG Bandung)Using Aws As A Game Server (AWS UG Bandung)
Using Aws As A Game Server (AWS UG Bandung)
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
Extending ansible
Extending ansibleExtending ansible
Extending ansible
 
Sympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMSSympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMS
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 
Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worlds
 
Plone on Amazon EC2
Plone on Amazon EC2Plone on Amazon EC2
Plone on Amazon EC2
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UK
 
Deploying PHP Applications with Ansible
Deploying PHP Applications with AnsibleDeploying PHP Applications with Ansible
Deploying PHP Applications with Ansible
 
Scaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkScaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic Beanstalk
 
Server Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsServer Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.js
 
WP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealWP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp Montreal
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
 
JRubyConf 2009
JRubyConf 2009JRubyConf 2009
JRubyConf 2009
 
Chef + AWS + CodeIgniter
Chef + AWS + CodeIgniterChef + AWS + CodeIgniter
Chef + AWS + CodeIgniter
 
eMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseeMusic: WordPress in the Enterprise
eMusic: WordPress in the Enterprise
 
[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReaders
[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReaders[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReaders
[Rakuten TechConf2014] [C-2] Big Data for eBooks and eReaders
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
 
Ansible Berlin Meetup Intro talk by @danvaida
Ansible Berlin Meetup Intro talk by @danvaidaAnsible Berlin Meetup Intro talk by @danvaida
Ansible Berlin Meetup Intro talk by @danvaida
 
Going Serverless with OpenWhisk
Going Serverless with OpenWhiskGoing Serverless with OpenWhisk
Going Serverless with OpenWhisk
 

Similar to Ansible Server and Network Automation

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
 
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 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 MeetupJeff Geerling
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible referencelaonap166
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansibleKhizer Naeem
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with AnsibleAhmed AbouZaid
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with AnsibleAnas
 
Ansible Oxford - Cows & Containers
Ansible Oxford - Cows & ContainersAnsible Oxford - Cows & Containers
Ansible Oxford - Cows & Containersjonatanblue
 
ansible : Infrastructure automation,idempotent and more
ansible : Infrastructure automation,idempotent and moreansible : Infrastructure automation,idempotent and more
ansible : Infrastructure automation,idempotent and moreSabarinath Gnanasekar
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAlberto Molina Coballes
 
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
 
06 network automationwithansible
06 network automationwithansible06 network automationwithansible
06 network automationwithansibleKhairul Zebua
 
Understanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and PerformanceUnderstanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and PerformanceAmazon Web Services
 
Ansible Network Automation session1
Ansible Network Automation session1Ansible Network Automation session1
Ansible Network Automation session1Dhruv Sharma
 
Containerization Is More than the New Virtualization
Containerization Is More than the New VirtualizationContainerization Is More than the New Virtualization
Containerization Is More than the New VirtualizationC4Media
 

Similar to Ansible Server and Network Automation (20)

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.
 
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.
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
 
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
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
 
Automation with ansible
Automation with ansibleAutomation with ansible
Automation with ansible
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Network Automation with Ansible
Network Automation with AnsibleNetwork Automation with Ansible
Network Automation with Ansible
 
Ansible Oxford - Cows & Containers
Ansible Oxford - Cows & ContainersAnsible Oxford - Cows & Containers
Ansible Oxford - Cows & Containers
 
ansible : Infrastructure automation,idempotent and more
ansible : Infrastructure automation,idempotent and moreansible : Infrastructure automation,idempotent and more
ansible : Infrastructure automation,idempotent and more
 
redhat_by_Cbitss.ppt
redhat_by_Cbitss.pptredhat_by_Cbitss.ppt
redhat_by_Cbitss.ppt
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
 
06 network automationwithansible
06 network automationwithansible06 network automationwithansible
06 network automationwithansible
 
Understanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and PerformanceUnderstanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and Performance
 
Ansible Network Automation session1
Ansible Network Automation session1Ansible Network Automation session1
Ansible Network Automation session1
 
ansible_rhel.pdf
ansible_rhel.pdfansible_rhel.pdf
ansible_rhel.pdf
 
Ansible.pdf
Ansible.pdfAnsible.pdf
Ansible.pdf
 
Containerization Is More than the New Virtualization
Containerization Is More than the New VirtualizationContainerization Is More than the New Virtualization
Containerization Is More than the New Virtualization
 
Perl in Teh Cloud
Perl in Teh CloudPerl in Teh Cloud
Perl in Teh Cloud
 

Recently uploaded

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Ansible Server and Network Automation

  • 1. www.anm.com Ansible: Server and Network Device Automation Klaus Mueller & Ian Logan www.anm.com June 8, 2018
  • 2. www.anm.com Who we are Klaus Mueller Senior Solutions Architect, ANM • Route/Switch CCIE #5450 • 30+ years experience in IT • 20 years experience working with State/Local, Healthcare, Education, and Commercial in New Mexico • Specialize in campus and data center networks Ian Logan Senior Solutions Architect, ANM • 20 years at NMSU – Data center architecture – Private networks for energy management systems – Unix & Linux systems administration • Specialize in data center virtualization and automation
  • 3. www.anm.comwww.anm.com ANM is headquartered in Albuquerque, NM and operates in Colorado, Texas and New Mexico. In addition to Albuquerque, ANM has offices in Denver (CO), Colorado Springs (CO) and El Paso (TX).
  • 4. www.anm.com Evolution of Network Configuration First Cisco Router 1986 Latest Cisco Router 2018 CLI via console and Telnet CLI via console and SSH
  • 5. www.anm.com There are tools… … but they are costly and frustrating …and often go un-/under-used
  • 6. www.anm.com …and old habits die hard… Notepad Copy & Paste
  • 7. www.anm.com Meanwhile in Servers… Server Virtualization Linux DevOps Chef/Puppet PowerShell Cloud vRA Technologies Methodologies Tools Open Source
  • 8. www.anm.com To be fair… Data Center Network Fabrics Cisco ACI VMware NSX Software Defined Networks Network Function Virtualization (NFV) Network Programmability APIs and Standards NetDevOps “Infrastructure as Code”
  • 9. www.anm.com More on “Software Defined” Software Defined Networks Many approaches: • Controller-based, centralized data plane (e.g. OpenFlow) • Central policy engine (e.g. Cisco ACI) Focus has been on data center – ACI, Vmware NSX Evolving to WAN (SD-WAN – e.g. Viptela, Riverbed), and Access (SD-Access – e.g. Cisco Digital Network Architecture, aka DNA) Very promising, still early in adoption in most orgs.
  • 10. www.anm.com “The Holy Grail” Be like Facebook Automatically deploy a fully populated rack of servers and network gear with minimal intervention. Or somewhere in between… • Standardized configs • Automated deployment • Push changes quickly • Automate repetitive tasks
  • 12. www.anm.com • Python – Scripting • Linux (or Mac OS X) – Using open-source tools • Templating – Jinja • Programmability – REST APIs – YAML, JSON, XML – NETCONF • Data Models – YANG Network Engineers need new skills
  • 13. www.anm.com “DevOps Tools” can help bridge the gap • Automation – Configuration deployment and management • Open Source • Community Driven • Many learning resources • Chef and Puppet – Agent-based • Ansible and Salt – Agent-less
  • 14. www.anm.com • Agent-less • Works well for both network and servers • Idempotent configuration management • Modular framework • Supported by Red Hat • Works with templates and variables • Communicates over SSH • Simple templating language (Playbooks = YAML) Ansible – “The Easier Button”
  • 16. www.anm.com Ansible – Deep dive How would you describe Ansible in one sentence? • A tool for expressing the desired state of a system at a high level.
  • 17. www.anm.com Ansible – Deep dive • Ansible plays nicely with just about everyone!
  • 18. www.anm.com Ansible – Deep dive • Requirements for installing Ansible – Python 2.6/2.7 or 3.5 and newer – A Unix like system to act as the control machine
  • 19. www.anm.com Ansible – Deep dive Playbook Ansible Engine Managed Node SSH • Inventory Host File • API • Modules • Password Vault • Unix/Linux/Windows • Cisco IOS/NXOS/ACI • vSphere • And many more… • A YAML doc • Living MOP
  • 20. www.anm.com Ansible – Deep dive • Choices on installing Ansible – Vendor packages or Python pip – Packages might be a little stale but ease of maintenance is probably worth it.
  • 21. www.anm.com Ansible – Deep dive • We’ll use CENTOS 7.5 for our examples. • Its that easy.
  • 22. www.anm.com Ansible – Deep dive • Ansible’s master config file – ansible.cfg ANSIBLE_CONFIG Env. variable ansible.cfg Incurrent directory $HOME/.ansible.cfg /etc/ansible/ansible.cfg The first one found wins
  • 23. www.anm.com Ansible – Deep dive We’ll take all the defaults except for 2 lines
  • 24. www.anm.com Ansible – Deep dive Ansible’s inventory system: • A simple text file. • Dynamic inventory from AWS, OpenStack, etc. • You can use both simultaneously.
  • 25. www.anm.com Ansible – Deep dive Ansible host file: • INI style formatting • Group names are in [] • Hosts can belong to multiple groups • Groups can be nested
  • 26. www.anm.com Ansible – Deep dive Linux demo environment: – Precreated a user named “ansible” on each machine – SSH authorized_keys configuration – Added sudo configuration for the ansible user – These steps are all optional, but they make the demo easier.
  • 27. www.anm.com Ansible – Deep dive Ansible one liners for Linux:
  • 28. www.anm.com Ansible – Deep dive Ansible facts & variables: • Facts are variables that describe the system being managed • Facts can be automatically gathered • You reference a variable with “{{ variable }}”
  • 29. www.anm.com Ansible – Deep dive Ansible facts & variables: • You can get all of the facts for a device with a one liner – ansible ios-devices -c network_cli -m ios_facts – ansible linux -m setup
  • 30. www.anm.com Ansible – Deep dive • Gathering facts takes a while • On a Linux host it there are over 100 facts • Output from many one liners will be in JSON
  • 31. www.anm.com Ansible – Deep dive Ansible playbooks: • Playbooks are our tool for automating complex tasks. • Playbooks also allow us to express orchestration across multiple managed nodes. • They’re written as YAML documents.
  • 32. www.anm.com Ansible – Deep dive YAML: • Indentation matters!! – Indent to group related items • # begins a comment • - - - begins a YAML document • - to denote list elements
  • 33. www.anm.com Ansible – Deep dive A sample playbook: • Hosts: the target nodes • Become* do we need elevated privileges? • Tasks: list of things to do – We call these plays • Yum is an ansible module – Name: httpd – a RPM name – State: present or absent
  • 34. www.anm.com Ansible – Deep dive Running a playbook:
  • 35. www.anm.com Ansible – Deep dive Playbooks can be executable scripts: • Add a “#!/usr/bin/ansible-playbook” as the first line • Make the file executable
  • 36. www.anm.com Ansible – Deep dive Lets get rid of Apache:
  • 37. www.anm.com Ansible – Deep dive One more Linux playbook: • One play with two tasks
  • 39. www.anm.com Ansible – Deep dive Lets look at a Network playbook: • Inventory_hostname is a builtin variable
  • 40. www.anm.com Ansible – Deep dive {{ inventory_hostname }} is replaced with the name of the current node
  • 41. www.anm.com Ansible – Deep dive • We can iterate across lists with items • Parents are how we change the config context for IOS
  • 43. www.anm.com Ansible – Deep dive Make sure you write the entire command! – Ios_config module makes comparisons between the playbook and the running config. – If its not an exact match, the command is executed at every run.
  • 44. www.anm.com Ansible – Deep dive We’re not using SSH keys to login to the router, where’s the password? • We can store the password in a variable. • Variables can be stored in encrypted files called vaults.
  • 45. www.anm.com Ansible – Deep dive How do we organize per host or group variables? • We can put them in the playbook itself. • We can create host/group variables in the host_vars/group_vars directory. – One file for each host/group.
  • 46. www.anm.com Ansible – Deep dive Host variables for an IOS device • Ansible_connection: network_cli removes the need for python on the node • Ansible_network_os: ios, vyos, junos, etc. • Ansible_ssh_pass: the login password
  • 48. www.anm.com DevOps: “The 3 Ways” via Gene Kim, et al see “The Phoenix Project” and “The DevOps Handbook”
  • 49. www.anm.com E.g. Use Cases • Regular, repetitive tasks • Large-scale infrequent tasks – pushing config changes to large number of devices • In-frequent tasks that require consistency – e.g. device deployment • Building Flow: Theory of Constraints – manual tasks that take a long time that can be automated • Pushing configs to multiple device • Templatizing config changes • Automating config changes • Automating deployments • Reporting and compliance
  • 52. www.anm.com Websites • Ansible Website: www.ansible.com – Documentation, Quick Start videos, Tutorials • Cisco DevNet: developer.cisco.com – Free login – Free training • "Network Programmability for Network Engineers” • Ansible videos and learning labs
  • 53. www.anm.com Links • Ansible.com – Documentation and Quick Start videos: docs.ansible.com • Developer.cisco.com – ”Introduction to Ansible” https://learninglabs.cisco.com/lab/ansible-02_ansible-intro/step/1 – “NetDevOps” videos – Ansible for Cisco configuration management https://developer.cisco.com/video/net-prog-basics/05-netdevops – “Getting Hands on with Ansible” Learning Lab https://learninglabs.cisco.com/lab/ansible-03_ansible-hands-on/step/1
  • 54. www.anm.com Contact Us • See us at ANM table in the Vendor Fair – Demo capability • Email us: – Klaus.Mueller@anm.com – Ian.Logan@anm.com • https://www.slideshare.net/klausternm • www.anm.com