How to automate configuration management for free using Ansible, Ubuntu, VirtualBox

This how-to shows how to use free Ansible software to automate configuration of Cisco routers and links to other Ansible modules that apply to other vendors' gear and support other functionality

diagnostics / monitoring / manual configuration
Da-Kuk / Getty Images

Configuration management (CM) utilities can automate the configuration of network devices, saving time and eliminating many of the human errors introduced during manual configuration.

While this functionality is rolled up in software-defined networking and intent-based networking products, it can also be tapped for free using open-source software.

This article shows how to use the free Ansible CM utility from RedHat running on a free Ubuntu Linux operating system within a virtual server created with free VirtualBox software. For the purposes of this cookbook, Ansible is used to automate CM for Cisco IOS-based routers, but Ansible modules are available for other vendors gear and other utilities, including A10, Aruba, Citrix Netscaler, F5, Fortinet, Juniper, Palo Alto Networks and others.

Step 1: Launch the Ansible server

First, go to this site, download and install VirtualBox software to create a virtual machine on your computer where you can install Ubuntu and then run Ansible.

Go to this site and download the Ubuntu 18.04.1 LTS desktop edition to your local hard drive.

Now using VirtualBox, create an Ubuntu virtual machine on which to run Ansible.

In VirtualBox, click the blue “New” icon.

Type in the name of our virtual server: Ansible Server.

Select the Type: Linux.

Select the Version: Ubuntu (64-bit), click Next.

Give this system 4 GB of RAM (4096 MB), click Next.

Use the defaults of using 10GB of hard disk storage, leave “Create a virtual disk now” checked, click Create.

Leave the default VDI selected, click Next.

Leave the default “Dynamically allocated” selected, click Next.

Leave the file location and size default settings, click Create.

You see that one virtual server has been created.

Now you need to make some configuration settings before booting it up.

Select the Ubuntu virtual server from the list of virtual servers in VirtualBox and click on the “Settings” cog button.

Select Storage on the left pane of the Setting options.

Next to Controller: IDE, click the button to “Adds Optical Drive” > Choose Disk > Select the Ubuntu 18.04.1 ISO file downloaded previously.

Select Network, on the left pane of Setting options.

Select Bridged Adapter, under Adapter 1 tab, make sure “Enable Network Adapter” is checked.

Select Attached to: “Bridged Adapter” and under Name select the Ethernet interface of your computer, then click OK.

Now you are ready to start the virtual machine.

Click the “Start” green right-arrow icon. (Now the Ubuntu operating system will start to boot up.)

Select your language: English, Install Ubuntu

English, English, click Continue

Choose Normal Installation, Download updates while installing, click Continue.

Select Erase disk, click Install Now, click Continue.

Select your timezone, click Continue.

Enter a name, enter the virtual computer name, username and password, click Continue.

Let it install the software. This takes a few minutes.

Click “Restart Now” when prompted.

When it prompts “Remove the installation media”, press Enter.

Now the system is running, and you can logon to the VirtualBox console as the user you just created.

Go through the introductory screens > Next > Next > Next > Done.

The default resolution can be pretty small for many computers, so you can increase it if you like.  You might be able to simply scale the window to be larger by clicking and dragging the lower-right corner of the window.  You can also change the display size with the Displays app.  Click on the top-left “Activities”, type Displays, click on the Displays app. Under Resolution, select the resolution, Apply, Keep changes.

When prompted, install updates because you want to be working with the latest software. Enter your password and if prompted, restart the system.

Step 2: Configure the Ansible server

Now you want to further update and patch, and install some basic tools, python and Ansible on this system.

Log into the Ansible Server console in VirtualBox and launch a terminal window.

Click Activities, then type the word “Terminal” and the Terminal app will be listed. Click on that icon.

Run the following commands from the Terminal “$” prompt.  When you run the first sudo command you will be prompted for your password.

sudo apt update

sudo apt upgrade -y

sudo apt install openssh-server -y

sudo apt install net-tools -y

sudo apt install sshpass -y

sudo apt install tree -y

sudo apt install python python-pip python-setuptools -y

sudo apt install ansible -y

At this point you can use SSH to connect to the Ansible Server.

To continue reading this article register now