- Provision an instance as controller node for Ansible
- Follow the Ansible Installation Guide to install and configure ansible on the controller node.
- Clone this repo :
git clone https://github.com/Viranson/ansible-deploy-webapp.git && cd ansible-deploy-webapp
- Provision a client Linux host based on CentOS
- Install docker and docker-compose
- On the ansible instance, edit inventory.yml file and update the client host IP address on line "ansible_host"
- Edit group_vars/prod.yml file and update the client host user on line "ansible_user"
- Remove files/secrets/credentials.vault
- Create new file files/secrets/credentials.vault and edit with the following content:
---
ansible_password: clientpass
Note: Replace
clientpass
with your client instance real password.
- Encrypt the credentials file by running :
ansible-vault encrypt files/secrets/credentials.vault
Set your encryption password when it will be prompted.
- Deploy the webapp by running the ansible playbook "deploy.yml" with the command :
ansible-playbook -i inventory.yml --ask-vault-pass deploy.yml
Enter the client password first then the credentials encryption password when prompted.
- Deploy the webapp by running the ansible playbook "webapp.yml" with the command :
ansible-playbook -i inventory.yml --ask-vault-pass webapp.yml
Enter the client password first then the credentials encryption password when prompted.
- Edit wordpress.yml file and update the client host user on line "system_user"
- Deploy the stack by running the ansible playbook "wordpress.yml" with the command :
ansible-playbook -i inventory.yml --ask-vault-pass wordpress.yml
Enter the client password first then the credentials encryption password when prompted.