Getting Started with Ansible for Network Automation — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# Getting Started with Ansible for Network Automation

Ansible modules support a wide range of vendors, device types, and actions, so you can manage your entire network with a single automation tool. With Ansible, you can:

- Automate repetitive tasks to speed routine network changes and free up your time for more strategic work
- Leverage the same simple, powerful, and agentless automation tool for network tasks that operations and development use
- Separate the data model (in a playbook or role) from the execution layer (via Ansible modules) to manage heterogeneous network devices
- Benefit from community and vendor-generated sample playbooks and roles to help accelerate network automation projects
- Communicate securely with network hardware over SSH or HTTPS

Who should use this guide?

This guide is intended for network engineers using Ansible for the first time. If you understand networks but have never used Ansible, work through the guide from start to finish.

This guide is also useful for experienced Ansible users automating network tasks for the first time. You can use Ansible commands, playbooks and modules to configure hubs, switches, routers, bridges and other network devices. But network modules are different from Linux/Unix and Windows modules, and you must understand some network-specific concepts to succeed. If you understand Ansible but have never automated a network task, start with the second section.

This guide introduces basic Ansible concepts and guides you through your first Ansible commands, playbooks and inventory entries.

Getting Started Guide

- Basic Concepts
  - Control node
  - Managed nodes
  - Inventory
  - Modules
  - Tasks
  - Playbooks
- How Network Automation is Different
  - Execution on the Control Node
  - Multiple Communication Protocols
  - Modules Organized by Network Platform
  - Privilege Escalation: `enable` mode, `become`, and `authorize`
- Run Your First Command and Playbook
  - Prerequisites
  - Install Ansible
  - Establish a Manual Connection to a Managed Node
  - Run Your First Network Ansible Command
  - Create and Run Your First Network Ansible Playbook
  - Gathering facts from network devices
- Build Your Inventory
  - Basic Inventory
  - Add Variables to Inventory
  - Group Variables within Inventory
  - Variable Syntax
  - Group Inventory by Platform
  - Protecting Sensitive Variables with `ansible-vault`
- Use Ansible network roles
  - Understanding roles
  - Ansible supported network roles
  - Network roles release cycle
- Beyond the basics
  - A typical Ansible filetree
  - Tracking changes to inventory and playbooks: source control with git
- Resources and next steps
  - Documents
  - Events (on video and in person)
  - GitHub repos
  - IRC and Slack