If you've ever been interested in learning Ansible and how to use it in deploying your PHP applications, you should check out this new tutorial from Stephen Rees-Carter on the DigitalOcean blog. He walks you through the full process for getting the server and application set up and configured just the way you need it (on a Ubuntu server).
This tutorial covers the process of provisioning a basic PHP application using Ansible. The goal at the end of this tutorial is to have your new web server serving a basic PHP application without a single SSH connection or manual command run on the target Droplet. We will be using the Laravel framework as an example PHP application, but these instructions can be easily modified to support other frameworks and applications if you already have your own.
He starts with a list of the things you'll already need installed and things to know including a basic understanding of Ansible and two servers (they use their own Droplets in the examples). From there, they walk you through a seven step process to get the automated deployment up and running:
- Installing Ansible
- Installing Required Packages
- Modifying System Configuration Files
- Cloning the Git Repository
- Creating an Application with Composer
- Updating Environment Variables
- Configuring Nginx
Some of the steps here are Laravel-specific as mentioned but if you're familiar with the setup of your own application, it's pretty easy to adapt. Each step includes the configuration changes and commands you'll need to complete it.