Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50549 Library:100121 in /var/www/html/wordpress/wp-includes/wp-db.php on line 1531 December 4, 2015 - Taylor Lovett
Ansible is a powerful tool to automate the provisioning and maintenance of servers. There are a variety of other provisioner tools like Puppet, Chef, and Salt available. Ansible is awesome because it works over SSH so is simple to setup; you ONLY need to install stuff on your local machine.
Working on a server without a provisioner is similar to writing code without version control. It’s a huge pain. Using this playbook will provision and maintain server(s) with the latest stable versions of nginx, PHP-FPM, MariaDB, WordPress, Memcache, Webgrind, and Postfix.
I wrote a simple Ansible playbook that provisions a high speed WordPress environment.
Here are the steps to use it:
1. Install Ansible locally. (this is for OSX, see installation instructions for more operatoring systems):
sudo easy_install pip
sudo pip install ansible
2. Clone the repository onto your local machine:
[code]git clone email@example.com:tlovett1/wordpress-ansible-playbook.git && cd wordpress-ansible-playbook[/code]
3. Now we will create a file to tell Ansible where our servers we want to provision/maintain are. Create a file in the root of your playbook named hosts:
In this file we can create as many hosts as we want in the event that we want to provision/maintain multiple environments.
4. Now it’s time to do our first provision. In the terminal enter the following:
ansible-playbook -i hosts site.yml
Remember, Ansible uses SSH so your SSH keys will need to be setup correctly. This playbook will default try the root user on each of your servers (as defined above) so adjust your keys appropriately.
That’s it! Your server(s) should be provisioned and ready to go. Continuing to run the playbook on an existing site will not overwrite or break anything but will upgrade things as needed. This is a great way to bulk manage/update a group of servers. Want to upgrade PHP on all your servers? Just run your playbook. Want to deploy a security patch to all your servers? Add it to your playbook and rerun.