How to deploy multinode WordPress on DreamCompute using Ansible

Why Ansible?

Ansible is a configuration management tool that has OpenStack integration built
in. This means you can use ansible not only to configure your servers, but when
running them on OpenStack, ansible can create and destroy servers for you.
Deploying a multinode WordPress site is tedious and long as you can see in
the manual tutorial
. You can automate all those steps easily with Ansible following the
instructions below.

Installing Ansible

In order to install Ansible, you need a few dependencies first, python2,
python-virtualenv, and python-pip. In order to install those, run the
following.

Type in your password for sudo (If you have one). It then will download some
packages and install them. Next we need to install Shade and Ansible in a
virtual environment, Shade is a library that Ansible uses to talk to OpenStack.
In order to do that, run the following.

Running the playbook

This will create your WordPress site, after it runs, visit the IP address of
your balancer, and if everything worked you should see a WordPress site. The
full run of the playbook may take 8 - 12 minutes.

Extra configuration

There are several configuration changes that can be made to the playbook to
modify the WordPress site it creates. Take a look at the “vars/dreamhost.yml”
file:

stack_size is the variable that defines how many servers to use for your
site. The number of webservers you have is stack_size-2.

flavor_name is the flavor of server to use for the servers, change this
to whatever server flavor you want.

volume_size is the size of the volume to put your MySQL database on. A
bigger site with more data will need a bigger volume.

wp_theme is the WordPress theme to use with the site.

wp_title is the title of the WordPress site

The “group_vars/all.yml” file also has some configuration:

db_user is the database user that wordpress will use

db_pass is the password for the database user that wordpress will use, it
also gets used as the admin password for the website. The default setting
will generate a random password using ascii characters that is 8 letters long
and store it in /tmp/sqlpassword