Zum Hauptinhalt springen
Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Network Automation Cookbook -  Christian Adell,  Jeffrey Kala,  Karim Okasha

Network Automation Cookbook (eBook)

Over 100 recipes to effectively configure and manage network infrastructure with Ansible
eBook Download: EPUB
2025 | 1. Auflage
566 Seiten
Packt Publishing (Verlag)
978-1-83588-799-8 (ISBN)
Systemvoraussetzungen
39,59 inkl. MwSt
(CHF 38,65)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Network Automation Cookbook, now in its second edition, is your essential guide to building robust network automation workflows across modern hybrid infrastructures. Building on the foundation laid in the first edition, this version dives deeper into Ansible's role in automating network infrastructure, expanding coverage to include modern use cases across enterprise and cloud networks.
The book introduces Ansible's core concepts, such as playbooks, inventories, variables, loops, and templates, and progresses to advanced topics such as parallelism, fact caching, custom filters, and modular design. You will automate real-world scenarios using Nokia SR, Cisco IOS, Juniper, and Arista devices in a fully reproducible virtual lab. The chapters also help you explore cloud automation for AWS, Azure, and Google Cloud, and integrate validation tools such as PyATS, Batfish, and Nautobot. New chapters cover event-driven automation, AWX for workflow execution, and Terraform integration. By using hands-on labs and fully reproducible recipes, you can practice real-world scenarios and reinforce your skills.
By the end of this book, you'll be well-equipped with the tools and workflows to automate infrastructure efficiently with Ansible.


Explore network automation with Ansible by configuring network infrastructure fast, reliably, and repeatedly, all while creating a lab utilizing open and available network operating systems and toolsKey FeaturesDesign, build, and automate network devices and cloud networking resources using AnsibleOrchestrate workflows with AWX and integrate Nautobot as a Source of TruthStart with Event-Driven Ansible and manage Terraform workflows seamlesslyPurchase of the print or Kindle book includes a free PDF eBookBook DescriptionNetwork Automation Cookbook, now in its second edition, is your essential guide to building robust network automation workflows across modern hybrid infrastructures. Building on the foundation laid in the first edition, this version dives deeper into Ansible's role in automating network infrastructure, expanding coverage to include modern use cases across enterprise and cloud networks. The book introduces Ansible s core concepts, such as playbooks, inventories, variables, loops, and templates, and progresses to advanced topics such as parallelism, fact caching, custom filters, and modular design. You will automate real-world scenarios using Nokia SR, Cisco IOS, Juniper, and Arista devices in a fully reproducible virtual lab. The chapters also help you explore cloud automation for AWS, Azure, and Google Cloud, and integrate validation tools such as PyATS, Batfish, and Nautobot. New chapters cover event-driven automation, AWX for workflow execution, and Terraform integration. By using hands-on labs and fully reproducible recipes, you can practice real-world scenarios and reinforce your skills. By the end of this book, you ll be well-equipped with the tools and workflows to automate infrastructure efficiently with Ansible.What you will learnBuild Ansible playbooks, roles, and inventories from scratchAutomate Cisco, Juniper, Arista, and F5 network devicesDeploy cloud networks on AWS, Azure, and Google CloudValidate networks with Batfish, PyATS, and NAPALMUse AWX for workflow automation and job schedulingIntegrate NetBox or Nautobot as dynamic inventory sourcesRun all recipes in containerized, hardware-free labsApply event-driven automation using Ansible RulebooksWho this book is forThis second edition will help network engineers, DevOps pros, cloud architects, automation engineers, and NREs understand Ansible s role in network automation and how it integrates with tools like Terraform and event-driven architectures. The book requires basic networking knowledge and familiarity with YAML to maximize learning.]]>

Preface


When the first edition of Network Automation Cookbook was published, the networking industry was at a turning point. Teams around the world were beginning to shift from manual, error-prone configurations toward automation-driven operations. Ansible, with its simple and human-readable approach, stood out as a tool that could bridge the gap between traditional network engineers and modern infrastructure-as-code practices.

Since then, the landscape has evolved dramatically.

In just a few years, Ansible has matured into a cornerstone of network automation. Vendors have expanded support, the community has grown, and new tools have emerged to extend its reach from dynamic inventory management and multi-vendor abstraction layers to event-driven automation and cloud-native networking. At the same time, automation practices have moved beyond one-off tasks and scripts to integrated, production-grade workflows that span physical, virtual, and cloud infrastructure.

This second edition is a reflection of that evolution.

We’ve completely refreshed the book to go beyond just automating CLI commands or pushing configurations. This edition is designed to guide you through building scalable, maintainable, and vendor-agnostic automation solutions using Ansible as the foundation. You’ll find practical recipes across on-premises data center automation, public cloud networking, source-of-truth integration, network validation, event-driven workflows, and the increasingly common need to combine Ansible with Terraform for full stack infrastructure automation.

Each chapter is hands-on, actionable, and focused on solving real-world problems. Whether you’re rendering configurations for Arista, automating a Juniper core, managing Nokia SR Linux devices, or deploying networking in AWS, Azure, or GCP, this book provides a clear and tested approach.

New additions such as Ansible EDA to explore event-driven Ansible for reactive workflows, Nautobot (similar to what you could do with NetBox or Infrahub) for dynamic inventory and source-of-truth-driven automation, and how Terraform and Ansible can coexist to deliver end-to-end automation in heterogeneous environments—take this edition far beyond the basics.

If you’re a network engineer looking to adopt automation, an infrastructure architect aiming to scale network operations, or a developer integrating network changes into CI/CD pipelines, this cookbook is for you.

We hope this second edition helps you move confidently from manual operations to modern, automated network engineering. The recipes in this book are based on real-world experience, field-tested tools, and a passion for making networking more reliable, repeatable, and programmable.

Let’s build the future of networking—one playbook at a time.

Who this book is for


This book is for network and DevOps engineers seeking to enhance their network operations via network automation, leveraging Ansible and other tools that complement it. Basic experience with YAML, Python, and network automation concepts is recommended to get the most out of this book.

What this book covers


Chapter 1, Why Ansible for Network Automation?, details the different ways of installing Terraform manually, with scripts, or by using a Docker container, and it also details the Terraform migration configuration process.

Chapter 2, Building Blocks of Ansible, concerns the writing of Terraform configurations for a provider, variables, outputs, built-in functions, condition expressions, Yaml file manipulation, and pre and post conditions.

Chapter 3, Advanced Ansible Concepts, shows you how to build dynamic environments by going further with Terraform configuration writing using loops, maps, and collections.

Chapter 4, Building Data Center Networks with Arista, explores how to use Terraform with external data and local files, and how to execute local programs and scripts with Terraform.

Chapter 5, Automating a Juniper Network Core Using Ansible, explains Terraform State management, including reading, moving, deleting, and importing resources into the Terraform State.

Chapter 6, Managing Nokia SR Devices Using Ansible, explains the use of Terraform’s CLI to validate the configuration, use outputs, destroy resources provisioned by Terraform, use workspaces, generate dependency graphs, and debug the execution of Terraform.

Chapter 7, Administering a Multi-Vendor Network with NAPALM and Ansible, covers the creation, use, and sharing of Terraform modules, and shows testing module practices.

Chapter 8, Deploying and Operating AWS Networking, illustrates the use of Terraform in a practical scenario with the cloud provider Azure. It covers topics such as authentication, remote backends, ARM templates, Azure CLI execution, and Terraform configuration generation for an existing infrastructure.

Chapter 9, Deploying and Operating Azure Networking, provides a starting point for provisioning AWS and GCP infrastructure using Terraform, and includes details on these providers, authentication, and remote backend storage.

Chapter 10, Deploying and Operating GCP Networking, explains how to use Terraform to create Docker containers and deploy Kubernetes resources.

Chapter 11, Network Validation with Batfish, details Terraform configuration testing practices using several tools like Tfsec, OPA, terraform-compliance, and Pester.

Chapter 12, Building a Network Inventory with Nautobot, discusses topics that go further with Terraform, such as the execution of Terraform configuration tests, zero-downtime deployment, Terraform wrappers with Terragrunt, checking configuration using Git-Hook, and using the Terraform CDK as a developer.

Chapter 13, Simplifying Automation with AWX, explores local Terraform automation processes, and implementing a CI/CD pipeline to apply Terraform configuration automatically.

Chapter 14, Event-Driven Automation with Ansible, explains how to use Terraform Cloud to run Terraform in a team with the sharing of Terraform modules in a private registry, the use of remote backends for Terraform State, migrating Terraform State, running Terraform remotely, and integrating cost estimation.

Chapter 15, Terraform and Ansible Dancing Together, lists several Terraform errors and explains how to resolve them.

Chapter 16, Appendix - The Lab, contains a Terraform Cheat Sheet command line and my Terraform resources list.

To get the most out of this book


Start setting up your lab environment as described in Chapter 16; all the recipes can be reproduced from it. It is still possible to follow the recipes without using the lab.

Download the example code files


The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Network-Automation-Cookbook_2nd_Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing. Check them out!

Conventions used


There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “Run the pb_arista_facts.yml playbook to validate the operational state of our fabric.”

A block of code is set as follows:

--- - name: “CREATE OUTPUT CONFIGS DIRECTORY”   ansible.builtin.file:     path: {{ config_output_root_dir }}     state: “directory”   run_once: yes

Any command-line input or output is written as follows:

ansible-playbook pb_validate_facts.yml PLAY [Collect and Validate Arista DC Fabric Facts] ************** TASK [Collect Arista Device Facts] ****************************** ok: [ceos-01] ok: [ceos-02] ok: [ceos-03]

Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “Create a new organization, Network, for all network teams—as shown in the following screenshot—by selecting Access Management and Organizations from the left panel and clicking the Create Organization button.”

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch


Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book or have any general feedback, please email us at customercare@packt.com and mention the book’s title in the subject of your message.

Errata: Although we have taken every care to...

Erscheint lt. Verlag 29.8.2025
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Netzwerke
ISBN-10 1-83588-799-6 / 1835887996
ISBN-13 978-1-83588-799-8 / 9781835887998
Informationen gemäß Produktsicherheitsverordnung (GPSR)
Haben Sie eine Frage zum Produkt?
EPUBEPUB (Ohne DRM)

Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopier­schutz. Eine Weiter­gabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persön­lichen Nutzung erwerben.

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich