Ansible Use Case: Automate System Configuration

Table of Contents


First released in 2012, Ansible has developed a reputation as a lightweight, nimble counterpart to other more mature tools. Ansible is designed to be easy to learn, and fast to use. Unlike other configuration management tools, Ansible does not require you to install a client on every server to be managed, and it can be run through the command line for simple tasks. This use case covers using Ansible to deploy and configure an application.

Use Case: Configuration Management

In these scenarios, we will discuss using Ansible to deploy and configure a PHP application and framework. The user is in charge of deploying this combination across many servers, and wants to simplify the job by using Ansible to streamline the process.

For information on how to install Ansible, see our article Set Up Ansible on Ubuntu 16.04.

Scenario 1: Application Deployment

In our example, the user is in charge of deploying a PHP application, and the framework (like Fat-Free Framework or Laravel) which supports it. The application and framework will need to be deployed on many servers in the future, so it's worth taking the time at the beginning to set up Ansible.

After setting up Ansible, the user needs only to run a single Ansible command, to execute the following actions with Ansible:

  1. Connect to the target server with SSH.
  2. Install the PHP framework.
  3. Transfer the application's files to the target server.

This scenario is described in more detail in our article Automate Deploying a PHP App Using Ansible on Ubuntu 16.04 which provides step-by-step instructions for the technical process.

Scenario 2: Flexibility

Not every user is in charge of managing thousands of servers across dozens of platforms. Some of us just want an easy way to do one or two things, with one or two servers. Ansible is flexible enough to work for both use cases.

The Ansible CLI tool means that it is easy to use in a small way for simple projects. However, it also scales up with Ansible playbooks, which can be used to deliver a long list of changes to as many (or as few) servers as you need to manage.

Scenario 3: Updates

When it comes time to update the application, Ansible is a useful tool to manage this process. This makes it a valuable part of a Continuous Delivery (CD) system.

Updates can be performed quickly and easily through the Ansible command line, if only a small update is needed on one or two servers. For larger deployments or a more involved process, Ansible playbooks can simplify and clarify the process.

Servers can be sorted into groups, with each group receiving a different set of updates, in order to account for architecture differences. The update process can also be performed in a controlled roll-out, so that only one group of servers is updated at a time.