IT 3110: System Automation

Automated Configuration

Configuration Management Tools




Many different ways, we will install with pip and hopefully get a fairly recent version.

Python is also required on any/all nodes that ansible will be talking to.

Ansible ssh

Ansible utilizes ssh. To make the best use of ansible, it is a good idea to setup and use keys. You probably already have a key, but if you don’t


Simple test

Create an /etc/ansible/hosts file. Should only consist of ip’s or hostnames. To test, just put a single ip address in there (i.e.

This pings all hosts in the hosts file.

Ansible Simple command

Contacts all nodes in the hosts file and runs a command on them. How would you run ifconfig on all your nodes.

Stop and add a second node to your hosts file. Re-run your commands.

Ansible Inventory

The default inventory location is /etc/ansible/hosts. If you wish to use a different inventory file, use the -i <path> option on the command line.

Inventory files

A file can look like this:




Inventory File

Here’s mine:

Ad-hoc commands

An ad-hoc command is something that you might type in to do something really quick, but don’t want to save for later. Helps us to understand a little bit about how ansible works. Perhaps it is something that is for one-time use as well.

Make sure to remember to have ssh-keys all set up.

Ad-hoc commands

Ad-hoc commands

Allows you to become another user to execure the command. Will prompt you for the sudo password.

Ad-hoc commands

This will scp foo.txt from my local machine to the destination on all target machines in the nancy group.

What will this do?

Ad-hoc commands (Files)

Guess what these do:

More Ad-hoc commands (APT)

Update apt repo:

Install apt package:

Ad-hoc commands (APT)

Remove package:

Ad-hoc commands (Users)

Add user:

Ad-hoc commands (Users)

Ad-hoc commands (Services)

Ensure that httpd process is started:

Or restart

Ad-hoc commands (Facts)

Gather facts about nodes:

Perhaps for later use in scripts

Lots of other modules

That you could use.