Network Automation Cookbook Pdf00002
Network Automation Cookbook Pdf00002
Network Automation Cookbook Pdf00002
Bassem Aly is a senior SDN/NFV solution consultant at Juniper Networks and has been
working in the telecom industry for the last 10 years. He is focused on designing and
implementing next-generation networks by leveraging different automation and DevOps
frameworks. Also, he has extensive experience in architecting and deploying telecom
applications over OpenStack. Bassem also conducts corporate training on network
automation and network programmability using Python and Ansible. Finally, he's an active
blogger on different technology areas and is the author of Hands-On Enterprise Automation
with Python, published by Packt.
How it works... 29
See also... 30
Using Ansible's filters 30
How to do it... 30
How it works... 31
Using Ansible Tags 32
How to do it... 32
How it works... 33
See also... 34
Customizing Ansible's settings 35
How to do it... 35
How it works... 35
See also... 36
Using Ansible Roles 36
How to do it... 36
How it works... 38
See also 39
Chapter 2: Managing Cisco IOS Devices Using Ansible 40
Technical requirements 41
Building an Ansible network inventory 42
Getting ready 42
How to do it... 42
How it works... 43
Connecting to Cisco IOS devices 43
Getting ready 43
How to do it... 44
How it works... 45
There's more... 47
Configuring basic system information 49
Getting ready 49
How to do it... 49
How it works... 50
See also... 51
Configuring interfaces on IOS devices 51
Getting ready 51
How to do it... 51
How it works... 53
See also... 53
Configuring L2 VLANs on IOS devices 53
Getting ready 53
How to do it... 54
How it works... 54
Configuring trunk and access interfaces 55
Getting ready 55
[ ii ]
Table of Contents
How to do it... 56
How it works... 57
See also... 58
Configuring interface IP addresses 58
Getting ready 58
How to do it... 58
How it works... 60
See also... 61
Configuring OSPF on IOS devices 61
Getting ready 61
How to do it... 61
How it works... 62
Collecting IOS device facts 63
Getting ready 63
How to do it... 63
How it works... 64
There's more... 65
See also... 66
Validating network reachability on IOS devices 66
Getting ready 67
How to do it... 67
How it works... 68
Retrieving operational data from IOS devices 69
Getting ready 69
How to do it... 69
How it works... 70
Validating network states with pyATS and Ansible 72
Getting ready 72
How to do it... 72
How it works... 74
See also... 75
Chapter 3: Automating Juniper Devices in the Service Providers Using
Ansible 76
Technical requirements 77
Building the network inventory 78
Getting ready 78
How to do it... 78
How it works... 79
Connecting and authenticating to Juniper devices 80
Getting ready 80
How to do it... 81
How it works... 82
There's more... 83
Enabling NETCONF on Junos OS devices 84
[ iii ]
Table of Contents
Getting ready 84
How to do it... 84
How it works... 85
Configuring generic system options on Juniper devices 85
Getting ready 86
How to do it... 86
How it works... 87
There's more... 88
See also... 92
Configuring interfaces on Juniper devices 93
Getting ready 93
How to do it... 93
How it works... 94
There's more... 95
Configuring OSPF on Juniper devices 97
How to do it... 97
How it works... 98
Configuring MPLS on Juniper devices 99
How to do it... 99
How it works... 100
Configuring BGP on Juniper devices 100
How to do it... 101
How it works... 102
Deploying configuration on Juniper devices 103
Getting ready 103
How to do it... 103
How it works... 104
There's more... 104
See also... 105
Configuring the L3VPN service on Juniper devices 105
Getting ready 105
How to do it... 106
How it works... 107
See also... 109
Gathering Juniper device facts using Ansible 109
Getting ready 109
How it works... 110
See also... 111
Validating network reachability on Juniper devices 111
Getting ready 112
How to do it... 112
How it works... 113
See also... 114
Retrieving operational data from Juniper devices 114
Getting ready 114
[ iv ]