Ansible Installation

Basic how to guide to Install Ansible quickly on Ubuntu. The full guide for Ubuntu is here.

Installation

Create the Inventory to Test

This file is named router_switch_inv.ini in my lab.

Test Topology

With three lines and a small file it is very simple to start interacting with network devices.

Inventory File in Depth

The ansible inventory file can be specified or a default location can be configured in the /etc/ansible/ansible.cfg file by adding the following lines.

Another change that can be made is to include group variables for things like usernames/passwords, device types and the ansible vault.

The inventory file looks like this, with a new group called “all_devcies”. This group holds all of my devcices and I can now apply variables to them. I could have created two files based off the group names.

The group_vars file is a yaml file and needs to be named the same as the group. Mine will need to be called all_devices.yml
The diagram will explain how it must look.

Below is a good example showing how I have the files structured.

Now when running commands there isn’t a need to specify the inventory file or the credentials. The device type being ios is used for the ios module.

Leave a Comment

Your email address will not be published. Required fields are marked *