The InMotion WordPress UltraStack is a curated set of services and configurations developed to provide what we believe is the best way to run a WordPress stack. We took the standard LAMP stack and extended it to also leverage Nginx as a caching layer and then used Redis to serve as an object cache.
Previously, this was only offered through our WordPress hosting plans. However, we decided to make our UltraStack configurations open-source. We also built Ansible Roles (available on Galaxy) that will provision it all for you. We also added some additional features as well, such as automatically obtaining and installing SSL certificates from Lets Encrypt.
In this tutorial, you’ll deploy WordPress UltraStack to your target Linux server using Git to clone the playbook down, Ansible Galaxy to download the roles, and Ansible to deploy the playbook. The resulting installation will give you what we believe to be the best possible WordPress installation. Follow the guide below in order to learn how to deploy WordPress UltraStack using Ansible and Git.
- Installing Ansible
- Use Git to Clone UltraStack Playbook
- Use Ansible Galaxy to Install the Playbook Roles
- Create your Inventory File
- Deploy WordPress Using Ansible
- A CentOS 7/8, Debian 8/9/10, or Ubuntu 16.04/18.04 server with at least 1 CPU Core, and 2GB of Ram
- A Control Node with Python and Git installed which can be a local machine or our InMotion Ansible Control Node
Our Ansible Control Node comes free with our Cloud Server Hosting plans.
Step 1 – Installing Ansible
In this step, you’ll install Ansible for your current user via pip, the Python package manager. If you do not have pip installed, you will need to run the following commands below to install it:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ python get-pip.py --user
Once pip is installed or if you already have pip, run the following to install Ansible. Otherwise, see other methods to install Ansible manually.
$ pip install --user ansible
Step 2 – Use Git to Clone UltraStack Playbook
Once Ansible is installed you can use Git to clone the InMotion WordPress UltraStack Playbook by running the following command below. If you do not have Git installed, you can follow official Git instructions to install it.
$ git clone \ https://github.com/inmotionhosting/wordpress-ultrastack-ansible.git
Then move into the directory by:
$ cd wordpress-ultrastack-ansible
Step 3 – Use Ansible Galaxy to Install the Playbook Roles
Now that we have the playbook cloned, you will need to install all the role dependencies using Ansible Galaxy via the command below. Learn more about Ansible Galaxy.
$ ansible-galaxy install -r playbook-requirements.yml
To verify that all the roles are installed you can run the following:
$ ansible-galaxy list # /home/user/.ansible/roles - inmotionhosting.mysql, 1.0.1 - inmotionhosting.nginx_proxy, 1.0.1 - inmotionhosting.redis, 1.0.1 - inmotionhosting.php_fpm, 1.0.1 - inmotionhosting.wordpress_ultrastack, 1.0.1 - inmotionhosting.apache, 1.0.1 # /etc/ansible/roles
Step 4 – Create your Inventory File
The WordPress UltraStack playbook comes with a sample inventory file that you can use. You can learn more about how to create Ansible Inventory files. First, you will want to copy the inventory file by running:
$ cp inventory.sample.yml inventory.yml
Then, edit your inventory.yml file to look like the following:
NOTE: To reduce space, the file comments have been removed in the example below.
wordpress: vars: use_ultrastack: true use_letsencrypt: false hosts: your_domain.com: system_user: "wordpress" site_domain: "domain.tld" site_email: "email@example.com" site_user: "example_username" site_pass: "example_password"
You will want to change these items explained below:
- your_domain.com – This should be the server that you want to target for the installation, this can be a domain or an IP address.
- system_user – Linux system user that the WordPress installation will be owned by and created under this user’s document root directory.
- system_domain – The domain associated with the WordPress installation. Simply use the domain name itself without defining a protocol or trailing ‘/’ characters.
- site_email – The email address of the WordPress administrator.
- site_user – The username of the WordPress administrator. It is very important to change this variable from the default.
- site_pass – The password of the WordPress administrator. It is also very important to change this variable from the default.
Step 5 – Deploy WordPress Using Ansible
Now that we have everything sorted away with the playbook, we can finally deploy this on your target server. To do so, use the ansible-playbook command like below:
$ ansible-playbook -i inventory.yml site.deploy.yml
Depending on the machine, this can take a few minutes to deploy.
With that you have the InMotion WordPress UltraStack installed on your server. To start using it, simply go to http://your_domain.com/wp-admin. There are a few options available to configure your WordPress UltraStack installation and for more information on what those customizations look like, you can view our sample inventory file on GitHub.
For more tutorials using Ansible, check out our Ansible Education Channel.