This Ansible project automates the deployment of a WordPress application using Vagrant. The project consists of three VMs:
- Ansible Controller: Responsible for managing and configuring the other VMs.
- MySQL Server: Database server for the WordPress application.
- WordPress: Web server hosting the WordPress application.
-
Clone the repository:
git clone https://github.com/AbderrahmaneOd/ansible-vagrant-wordpress cd ansible-vagrant-wordpress
-
Spin up the VMs using Vagrant:
vagrant up
-
Generate an SSH key pair on the Ansible Controller VM
ssh-keygen
Follow the prompts to generate the key pair. By default, the keys will be stored in the
~/.ssh/
directory. Then, copy the public key to the other VM.ssh vagrant@192.168.33.11 ssh vagrant@192.168.33.10
Note: Ensure that you can connect to both VMs without entering a password.
-
Connect to the Ansible Controller VM:
vagrant ssh ansible-controller
-
Navigate to the Ansible project directory:
cd /ansible
-
Install requirements:
ansible-galaxy install -r requirements.yml
-
Run the Ansible playbook to configure the MySQL Server and deploy WordPress:
ansible-playbook -i hosts wordpress.yml
-
Access WordPress in your web browser:
hosts
: Ansible inventory file specifying VM details.wordpress.yml
: Main Ansible playbook orchestrating the deployment.roles/
: Ansible roles containing tasks for WordPress.Vagrantfile
: Vagrant configuration file for VM setup.
- Abderrahmane Ouaday