You will provision a simple reverse-proxied LAMP infrastructure using the configuration management software Ansible and a Vagrant file to launch it. Your Vagrantfile should utilize the Puppletlabs CentOS 6.5 Vagrant box.
The infrastructure should consist of two server systems, each running the latest versions of available packages and services:
front
- nginx, memcachedapp
- apache2, php5.3, mysql-server
The process should perform the following steps:
- Setup
nginx
andmemcached
on thefront
server - Setup
apache2
,php5.3
,mysql-server
on theapp
server - Download and install the following PHP script into the document root of
Apache on
app
and make it the default page: test.php There may be other packages required on the servers to successfully execute the test.php script. - Download and run the following SQL script on
app
. After correctly loading, it should have loaded theinfratest
database with a test table: test.sql - Create and grant all privileges to user
infratest
on the MySQL databaseinfratest
with the passwordinfra1234
. - Add entries to the
/etc/hosts
file on both servers to map the hostsfront
andapp
to their respective IP addresses - Create firewall rules so that the reverse proxy server only accepts connections on port 80 from anywhere, while the app server only accepts connections on port 8080 from the proxy server.
- Configure nginx on the reverse proxy server to proxy HTTP requests on port 80 to the app server's Apache instance on port 8080.
- Configure nginx on the reverse proxy server to add the HTTP header
X-Forwarded-For
with the value of the IP address of the client making the request.
You will provide the Ansible Playbook and Vagrantfile to setup and
configure each server. Running 'vagrant up' will provision each server
to these requirements. Accessing nginx on http://front
should return test.php.
There should be no errors on the resulting test.php
page.