Automation Tools: Linux


A flavor of Linux is required in the environment to host the Ansible installation. Linux may be new, or there might be an existing Linux footprint in the enterprise. The Linux machine where Ansible is installed requires the ability to resolve the hostnames and SSH into all the network devices.

The Linux host needs to communicate with the source control server to perform Git operations such as cloning the repository to the Linux host. Using Git, updates from the repository can be pulled down, and output from Ansible playbooks can be pushed up into the repository. RBAC should be implemented, and standard best practices for a server installation (e.g, apply updates, harden the system) followed, because the Linux host will become a central component of the automation engine.

All Ansible playbooks are executed from this Linux host and as such, precautions should be taken to protect this system from unauthorized access.

Traditional Linux

Ansible can be installed and run on any Red Hat Enterprise Linux ™, CentOS, Fedora, Debian, or Ubuntu system.

Below are commands to install Ansible on different distributions of Linux:

On Fedora:

$ sudo dnf install ansible

On RHEL and CentOS:

$ sudo yum install ansible

On Ubuntu:

$ sudo apt-get update

$ sudo apt-get install software-properties-common

$ sudo apt-add-repository --yes --update ppa:ansible/ansible

$ sudo apt-get install ansible

Linux on Windows 10

The Linux requirement should not deter the organization from pursuing Ansible. The enterprise may not support Linux because either the network team may not be very familiar with Linux or they are a purely Microsoft shop. Linux on Windows is a relatively new supported feature from Microsoft. However, Ansible has been proven to run under Windows using the latest version of Windows Subsystems for Linux (WSL) and the Ubuntu distribution.

WSL and DrvFS

Microsoft WSL and DrvFS can be used to set the permissions using traditional Linux chmod commands. If we encounter errors when running Ansible playbooks in Windows, such as those due to the ansible.cfg file using world write permissions, we can use the following instructions to open chmod capabilities in Ubuntu:

First, unmount the drive.

sudo umount /mnt/c

Then remount the drive, including the metadata.

sudo mount -t drvfs C:/mnt/c -o metadata

Now set permissions on the repository.

chmod -R 755 /home/user/Production-Infrastructures

Get hands-on with 1200+ tech skills courses.