Book Image

Learn Ansible

By : Russ McKendrick
Book Image

Learn Ansible

By: Russ McKendrick

Overview of this book

Ansible has grown from a small, open source orchestration tool to a full-blown orchestration and configuration management tool owned by Red Hat. Its powerful core modules cover a wide range of infrastructures, including on-premises systems and public clouds, operating systems, devices, and services—meaning it can be used to manage pretty much your entire end-to-end environment. Trends and surveys say that Ansible is the first choice of tool among system administrators as it is so easy to use. This end-to-end, practical guide will take you on a learning curve from beginner to pro. You'll start by installing and configuring the Ansible to perform various automation tasks. Then, we'll dive deep into the various facets of infrastructure, such as cloud, compute and network infrastructure along with security. By the end of this book, you'll have an end-to-end understanding of Ansible and how you can apply it to your own environments.
Table of Contents (20 chapters)

Preinstallation tasks

As mentioned in the previous chapter, a LEMP stack is composed of the following elements:

  • Linux: In our case, this will be CentOS 7 again
  • NGINX: If you remember, it is pronounced as engine-x, and replaces Apache in our stack
  • MariaDB: As we have seen, this will be the database component
  • PHP: We will be using PHP 7.2 again for this

Before we install WordPress, we need to install and configure these components. Also, as this playbook is eventually going to be executed against publicly available cloud servers, we need to think about some best practices around our NGINX configuration.

Let's start by getting the initial structure of the playbook set up:

$ mkdir lemp lemp/group_vars
$ touch lemp/group_vars/common.yml lemp/production lemp/site.yml lemp/Vagrantfile lemp/.gitignore
$ cd lemp

Now that we have the basic layout, we need to put some content in the...