Deploying a web app with revision control systems
For this example, we are going to deploy a simple PHP application that will be composed of only a single PHP page. The source is available on the following repository: https://github.com/Fale/demo-php-app.
To deploy it, we will need the following code placed in playbooks/manual/rcs_deploy.yaml
:
- hosts: web user: ansible tasks: - name: Install or update website git: repo: https://github.com/Fale/demo-php-app.git dest: /var/www/application become: True
We can now run the deployer with the following command:
ansible-playbook -i inventory/production playbooks/manual/rcs_deploy.yaml
This is the expected result:
PLAY [web] ******************************************************* TASK [setup] ***************************************************** ok: [ws01.fale.io] ok: [ws02.fale.io] .... PLAY RECAP ******************************************************...