SlideShare a Scribd company logo
NETWORK
AUTOMATION USING
PYTHON AND ANSIBLE
SUBMITTED BY:
RIMJHIM MISHRA
0101EC211096
SUBMITTED TO:
DR. MANISH AHIRWAR
ASSOCIATE PROFESSOR, DOCSE
CS-806
• Network automation is the practice of automatically
configuring, managing, and operating network devices
(routers, switches, firewalls, etc.) using software.
• Instead of manual CLI changes, engineers use scripts and
orchestration tools to apply policies and updates.
• Automation brings numerous benefits: increased
efficiency, since repetitive tasks run quickly and reliably;
fewer errors, as machines eliminate typos; and lower
costs, because one engineer can manage more
infrastructure.
• Industry reports highlight rapid adoption: Gartner
predicts the share of networks with “more than half” of
tasks automated will jump from under 10% in 2023 to 30%
by 2026.
Introduction to Network
Automation
Importance
of Network
Automation
• Network automation has become
critical for managing complex networks
reliably and at scale. By scripting
routine tasks, network teams improve
efficiency, consistency, and uptime.
Leading vendors note that manual
changes dominate today’s networks
(up to 95%), driving costs up .
• Automation reduces human error and
operational expenses.
• It covers Python libraries (Netmiko,
NAPALM, etc.) and Ansible’s model-
driven approach (playbooks, modules)
side-by-side.
Diagram
Why Network
Automation?
• Faster deployments and
changes
• Reduced configuration errors
• Improved compliance and
auditing
• Easier scalability and
repeatability
• Enables intent-based
networking
Tools for
Network
Automation
• Several tools have emerged to
support network automation:
• Python: Widely used for scripting
custom automation logic, interacting
with devices using SSH, APIs, and
libraries.
• Ansible: Open-source automation
tool for configuration management.
Uses YAML-based playbooks and is
agentless.
• Others:
• Netmiko & NAPALM: Python libraries
specifically built for network devices.
• Puppet/Chef/SaltStack: General
automation tools, less popular for
networks but still usable.
• Nornir: A Python automation
framework for complex workflows
Role of
Python in
Network
Automation
• Python is one of the most popular
languages for network engineers
because of its simplicity,
readability, and strong community
support. It enables engineers to:
• Write custom automation scripts
for unique environments.
• Interact with network devices via
SSH (Netmiko, Paramiko) or APIs
(RESTCONF, NETCONF).
• Build integrations with monitoring
and alerting systems.
• Python’s adaptability makes it
suitable for both small-scale and
large-scale network automation.
Python
Libraries
Overview
• Python has a rich set of libraries
that simplify network
automation:
• Netmiko: Provides simplified SSH
access to devices from vendors
like Cisco, Juniper, HP, etc.
• NAPALM: Multi-vendor support
with a common interface; useful
for configuration changes and
state validation.
• Paramiko: Lower-level SSH
library, flexible for secure
command execution.
• pySNMP: For SNMP-based
monitoring and management.
• Requests: Makes it easy to
interact with REST APIs for
devices supporting
RESTCONF/JSON-RPC.
Example
Python Script
Here’s a basic example of using
Netmiko to connect to a Cisco
device and retrieve interface
information:
from netmiko import
ConnectHandler
device = {
'device_type': 'cisco_ios',
'ip': '192.168.100.1',
'username': 'admin',
'password': 'admin123',
}
net_connect =
ConnectHandler(**device)
output =
net_connect.send_command('show
ip interface brief')
print(output)
Introduction
to Ansible
• Ansible is an open-source IT
automation engine that automates
tasks such as configuration
management, application
deployment, and network
provisioning.
• Unlike other tools, Ansible is
agentless, meaning it doesn’t
require software to be installed on
remote systems. It uses SSH or API
to communicate.
• Ansible is especially effective in
automating repetitive network
tasks across multiple devices using
YAML-based Playbooks.
Ansible
Architecture
• Control Node: The system where
Ansible is installed and
commands are executed from.
• Managed Nodes: The target
network devices or servers.
• Inventory: A file listing all
managed nodes (devices).
• Modules: Code units that Ansible
executes, like ios_config or
nxos_interface.
• Playbooks: Written in YAML,
defining the set of tasks to
execute.
• Ansible connects over SSH (or
APIs) and runs tasks
declaratively, meaning you
specify the desired state, and
Ansible ensures it’s achieved.
Ansible
Architecture
Ansible for
Network
Automation
• Ansible is increasingly used in
network automation because:
• It supports many network
platforms like Cisco IOS, NX-OS,
Arista EOS, Juniper JunOS, and
more.
• Offers vendor-specific and vendor-
neutral modules.
• Enables auditable and repeatable
deployments.
• Easy for non-programmers to
understand due to its simple YAML
structure.
• Can be integrated into DevOps
pipelines (CI/CD for networks).
Sample
Ansible
Playbook
- name: Configure Cisco Router
hosts: routers
gather_facts: no
connection: network_cli
tasks:
- name: Set hostname
ios_config:
lines: hostname R1
Python vs Ansible
Use Cases of
Network
Automation
• Network automation is used in a wide range of
scenarios, such as:
• Initial Configuration: Automating zero-touch
provisioning of new devices.
• Periodic Backups: Regularly backing up
configurations to central storage.
• Compliance Auditing: Ensuring devices meet
security policies.
• Bulk Changes: Rolling out ACLs or QoS settings
across multiple routers/switches.
• Monitoring Integration: Auto-generating tickets or
alerts based on network status.
Challenges & Best Practices
Challenges:
• Differences in CLI and APIs
across vendors
• Lack of device support or
outdated firmware
• Risk of outages due to
incorrect automation logic
• Steep learning curve for non-
programmers
Best Practices:
• Always test scripts in a lab environment
before deploying in production.
• Use Git for version control and change
tracking.
• Write modular, reusable
playbooks/scripts.
• Implement logging, validation, and
rollback options in your automation.
• Document everything and follow team
coding/automation standards.
Future of Network
Automation
The future of network automation is promising and evolving with technologies such as:
• AI/ML-Driven Automation: Predicting network issues and automating resolutions.
• Intent-Based Networking (IBN): Networks configure themselves based on business
intent.
• SDN and NFV: Further abstraction and automation at the network edge.
• Integration with cloud orchestration tools: Terraform, Kubernetes, and hybrid
infrastructure automation.
Key
Takeaways
• Network automation is crucial for modern IT
infrastructures.
• Python provides flexibility and control for custom
logic.
• Ansible enables scalable, readable, and repeatable
configuration management.
• Learning and combining both tools equips network
engineers to meet current and future demands.
• Start small, automate repetitive tasks, and scale
progressively toward a fully automated network
environment.
Thank you very
much!
PRESENTED BY RIMJHIM MISHRA

More Related Content

PPTX
DevOps in Network Engineering ( Network Automation using DevNet)
PDF
IBM Programmable Network Controller
PDF
Nozomi Networks SCADAguardian - Data-Sheet
PDF
Network Automation Journey, A systems engineer NetOps perspective
PDF
Using Kubernetes to make cellular data plans cheaper for 50M users
PPTX
SoC Solutions Enabling Server-Based Networking
PDF
17 - Building small network.pdf
PPTX
M1-C17-Armando una red.pptx
DevOps in Network Engineering ( Network Automation using DevNet)
IBM Programmable Network Controller
Nozomi Networks SCADAguardian - Data-Sheet
Network Automation Journey, A systems engineer NetOps perspective
Using Kubernetes to make cellular data plans cheaper for 50M users
SoC Solutions Enabling Server-Based Networking
17 - Building small network.pdf
M1-C17-Armando una red.pptx

Similar to Network Automation using Python and Ansible.pptx (20)

PDF
Banv meetup-contrail
PDF
Quick wins in the NetOps Journey by Vincent Boon, Opengear
PPTX
OSSF 2018 - Peter Crocker of Cumulus Networks - TCO and technical advantages ...
PDF
Cloud Networking Trends
PDF
Common industrial protocol
PDF
IBM InterConnect 2013 Expert Integrated Systems Keynote: Sotiropoulos & Wieck
PPT
Persentation of Cyber Security in Smart Grid
PPTX
ITNCCNA_NATWORKCOMMUNICATION_Module_17.pptx
PDF
OVNC 2015-Software-Defined Networking: Where Are We Today?
PPTX
APT iTest and Velocity 7.3 Use Cases.pptx
PDF
Cisco Connect 2018 Thailand - Cisco automation
PPTX
ITN_Module_17.pptx
PPTX
INT_Ch17.pptx
PDF
Bringing SDN to the Management Plane
DOCX
Resume_052715
PDF
Cisco project ideas
PPTX
Software defined network-- SDN
PDF
Net-Ace - Vendor-Agnostic Service Orchestration platform
PDF
ITN6_Instructor_Materials_Chapter11.pdf
PPT
Weaving the Future - Enable Networks to Be More Agile for Services
Banv meetup-contrail
Quick wins in the NetOps Journey by Vincent Boon, Opengear
OSSF 2018 - Peter Crocker of Cumulus Networks - TCO and technical advantages ...
Cloud Networking Trends
Common industrial protocol
IBM InterConnect 2013 Expert Integrated Systems Keynote: Sotiropoulos & Wieck
Persentation of Cyber Security in Smart Grid
ITNCCNA_NATWORKCOMMUNICATION_Module_17.pptx
OVNC 2015-Software-Defined Networking: Where Are We Today?
APT iTest and Velocity 7.3 Use Cases.pptx
Cisco Connect 2018 Thailand - Cisco automation
ITN_Module_17.pptx
INT_Ch17.pptx
Bringing SDN to the Management Plane
Resume_052715
Cisco project ideas
Software defined network-- SDN
Net-Ace - Vendor-Agnostic Service Orchestration platform
ITN6_Instructor_Materials_Chapter11.pdf
Weaving the Future - Enable Networks to Be More Agile for Services
Ad

More from rimjhimmishra1407 (6)

PPTX
Pulkit_dubey_uit rgpv 0101CS211099.pptx
PPTX
Unit 4 -IOT4 p latform designs methodology.pptx
PPTX
Group discussion Presentation uit rgpv
PPTX
IBPS SO IT Officer Mains Previous Year Question Paper.pptx
PPTX
ibps SO mains Syllabus for IT Officer Scale I --1.pptx
PPTX
MAJOR PRESENTATION for 7th semesters.pptx
Pulkit_dubey_uit rgpv 0101CS211099.pptx
Unit 4 -IOT4 p latform designs methodology.pptx
Group discussion Presentation uit rgpv
IBPS SO IT Officer Mains Previous Year Question Paper.pptx
ibps SO mains Syllabus for IT Officer Scale I --1.pptx
MAJOR PRESENTATION for 7th semesters.pptx
Ad

Recently uploaded (20)

PDF
313302 DBMS UNIT 1 PPT for diploma Computer Eng Unit 2
PPTX
Job-opportunities lecture about it skills
PPTX
Surgical thesis protocol formation ppt.pptx
PPT
BCH3201 (Enzymes and biocatalysis)-JEB (1).ppt
PPTX
AREAS OF SPECIALIZATION AND CAREER OPPORTUNITIES FOR COMMUNICATORS AND JOURNA...
PDF
esg-supply-chain-webinar-nov2018hkhkkh.pdf
PDF
シュアーイノベーション採用ピッチ資料|Company Introduction & Recruiting Deck
PDF
Manager Resume for R, CL & Applying Online.pdf
PPTX
E-Commerce____Intermediate_Presentation.pptx
PPTX
cse couse aefrfrqewrbqwrgbqgvq2w3vqbvq23rbgw3rnw345
PPTX
The Stock at arrangement the stock and product.pptx
PPTX
_+✅+JANUARY+2025+MONTHLY+CA.pptx current affairs
PPTX
ESD MODULE-5hdbdhbdbdbdbbdbdbbdndbdbdbdbbdbd
PPTX
Your Guide to a Winning Interview Aug 2025.
PPTX
FINAL PPT.pptx cfyufuyfuyuy8ioyoiuvy ituyc utdfm v
PDF
Blue-Modern-Elegant-Presentation (1).pdf
PDF
Sales and Distribution Managemnjnfijient.pdf
PPTX
PMP (Project Management Professional) course prepares individuals
PPTX
internship presentation of bsnl in colllege
PDF
Understanding the Rhetorical Situation Presentation in Blue Orange Muted Il_2...
313302 DBMS UNIT 1 PPT for diploma Computer Eng Unit 2
Job-opportunities lecture about it skills
Surgical thesis protocol formation ppt.pptx
BCH3201 (Enzymes and biocatalysis)-JEB (1).ppt
AREAS OF SPECIALIZATION AND CAREER OPPORTUNITIES FOR COMMUNICATORS AND JOURNA...
esg-supply-chain-webinar-nov2018hkhkkh.pdf
シュアーイノベーション採用ピッチ資料|Company Introduction & Recruiting Deck
Manager Resume for R, CL & Applying Online.pdf
E-Commerce____Intermediate_Presentation.pptx
cse couse aefrfrqewrbqwrgbqgvq2w3vqbvq23rbgw3rnw345
The Stock at arrangement the stock and product.pptx
_+✅+JANUARY+2025+MONTHLY+CA.pptx current affairs
ESD MODULE-5hdbdhbdbdbdbbdbdbbdndbdbdbdbbdbd
Your Guide to a Winning Interview Aug 2025.
FINAL PPT.pptx cfyufuyfuyuy8ioyoiuvy ituyc utdfm v
Blue-Modern-Elegant-Presentation (1).pdf
Sales and Distribution Managemnjnfijient.pdf
PMP (Project Management Professional) course prepares individuals
internship presentation of bsnl in colllege
Understanding the Rhetorical Situation Presentation in Blue Orange Muted Il_2...

Network Automation using Python and Ansible.pptx

  • 1. NETWORK AUTOMATION USING PYTHON AND ANSIBLE SUBMITTED BY: RIMJHIM MISHRA 0101EC211096 SUBMITTED TO: DR. MANISH AHIRWAR ASSOCIATE PROFESSOR, DOCSE CS-806
  • 2. • Network automation is the practice of automatically configuring, managing, and operating network devices (routers, switches, firewalls, etc.) using software. • Instead of manual CLI changes, engineers use scripts and orchestration tools to apply policies and updates. • Automation brings numerous benefits: increased efficiency, since repetitive tasks run quickly and reliably; fewer errors, as machines eliminate typos; and lower costs, because one engineer can manage more infrastructure. • Industry reports highlight rapid adoption: Gartner predicts the share of networks with “more than half” of tasks automated will jump from under 10% in 2023 to 30% by 2026. Introduction to Network Automation
  • 3. Importance of Network Automation • Network automation has become critical for managing complex networks reliably and at scale. By scripting routine tasks, network teams improve efficiency, consistency, and uptime. Leading vendors note that manual changes dominate today’s networks (up to 95%), driving costs up . • Automation reduces human error and operational expenses. • It covers Python libraries (Netmiko, NAPALM, etc.) and Ansible’s model- driven approach (playbooks, modules) side-by-side.
  • 5. Why Network Automation? • Faster deployments and changes • Reduced configuration errors • Improved compliance and auditing • Easier scalability and repeatability • Enables intent-based networking
  • 6. Tools for Network Automation • Several tools have emerged to support network automation: • Python: Widely used for scripting custom automation logic, interacting with devices using SSH, APIs, and libraries. • Ansible: Open-source automation tool for configuration management. Uses YAML-based playbooks and is agentless. • Others: • Netmiko & NAPALM: Python libraries specifically built for network devices. • Puppet/Chef/SaltStack: General automation tools, less popular for networks but still usable. • Nornir: A Python automation framework for complex workflows
  • 7. Role of Python in Network Automation • Python is one of the most popular languages for network engineers because of its simplicity, readability, and strong community support. It enables engineers to: • Write custom automation scripts for unique environments. • Interact with network devices via SSH (Netmiko, Paramiko) or APIs (RESTCONF, NETCONF). • Build integrations with monitoring and alerting systems. • Python’s adaptability makes it suitable for both small-scale and large-scale network automation.
  • 8. Python Libraries Overview • Python has a rich set of libraries that simplify network automation: • Netmiko: Provides simplified SSH access to devices from vendors like Cisco, Juniper, HP, etc. • NAPALM: Multi-vendor support with a common interface; useful for configuration changes and state validation. • Paramiko: Lower-level SSH library, flexible for secure command execution. • pySNMP: For SNMP-based monitoring and management. • Requests: Makes it easy to interact with REST APIs for devices supporting RESTCONF/JSON-RPC.
  • 9. Example Python Script Here’s a basic example of using Netmiko to connect to a Cisco device and retrieve interface information: from netmiko import ConnectHandler device = { 'device_type': 'cisco_ios', 'ip': '192.168.100.1', 'username': 'admin', 'password': 'admin123', } net_connect = ConnectHandler(**device) output = net_connect.send_command('show ip interface brief') print(output)
  • 10. Introduction to Ansible • Ansible is an open-source IT automation engine that automates tasks such as configuration management, application deployment, and network provisioning. • Unlike other tools, Ansible is agentless, meaning it doesn’t require software to be installed on remote systems. It uses SSH or API to communicate. • Ansible is especially effective in automating repetitive network tasks across multiple devices using YAML-based Playbooks.
  • 11. Ansible Architecture • Control Node: The system where Ansible is installed and commands are executed from. • Managed Nodes: The target network devices or servers. • Inventory: A file listing all managed nodes (devices). • Modules: Code units that Ansible executes, like ios_config or nxos_interface. • Playbooks: Written in YAML, defining the set of tasks to execute. • Ansible connects over SSH (or APIs) and runs tasks declaratively, meaning you specify the desired state, and Ansible ensures it’s achieved.
  • 13. Ansible for Network Automation • Ansible is increasingly used in network automation because: • It supports many network platforms like Cisco IOS, NX-OS, Arista EOS, Juniper JunOS, and more. • Offers vendor-specific and vendor- neutral modules. • Enables auditable and repeatable deployments. • Easy for non-programmers to understand due to its simple YAML structure. • Can be integrated into DevOps pipelines (CI/CD for networks).
  • 14. Sample Ansible Playbook - name: Configure Cisco Router hosts: routers gather_facts: no connection: network_cli tasks: - name: Set hostname ios_config: lines: hostname R1
  • 16. Use Cases of Network Automation • Network automation is used in a wide range of scenarios, such as: • Initial Configuration: Automating zero-touch provisioning of new devices. • Periodic Backups: Regularly backing up configurations to central storage. • Compliance Auditing: Ensuring devices meet security policies. • Bulk Changes: Rolling out ACLs or QoS settings across multiple routers/switches. • Monitoring Integration: Auto-generating tickets or alerts based on network status.
  • 17. Challenges & Best Practices Challenges: • Differences in CLI and APIs across vendors • Lack of device support or outdated firmware • Risk of outages due to incorrect automation logic • Steep learning curve for non- programmers Best Practices: • Always test scripts in a lab environment before deploying in production. • Use Git for version control and change tracking. • Write modular, reusable playbooks/scripts. • Implement logging, validation, and rollback options in your automation. • Document everything and follow team coding/automation standards.
  • 18. Future of Network Automation The future of network automation is promising and evolving with technologies such as: • AI/ML-Driven Automation: Predicting network issues and automating resolutions. • Intent-Based Networking (IBN): Networks configure themselves based on business intent. • SDN and NFV: Further abstraction and automation at the network edge. • Integration with cloud orchestration tools: Terraform, Kubernetes, and hybrid infrastructure automation.
  • 19. Key Takeaways • Network automation is crucial for modern IT infrastructures. • Python provides flexibility and control for custom logic. • Ansible enables scalable, readable, and repeatable configuration management. • Learning and combining both tools equips network engineers to meet current and future demands. • Start small, automate repetitive tasks, and scale progressively toward a fully automated network environment.
  • 20. Thank you very much! PRESENTED BY RIMJHIM MISHRA