This project automates the entire process of provisioning a server and deploying a complete, containerized WordPress site using Ansible. The playbook configures a bare Debian server, installs all necessary dependencies, and deploys WordPress along with its MySQL database using Docker.
The entire workflow is defined using Ansible Roles for modularity and reusability, and sensitive data is secured using Ansible Vault.
- Infrastructure as Code (IaC): Using Ansible to define and manage server configuration.
- Ansible Roles: Structuring the project in a clean, reusable, and professional manner.
- Secrets Management: Securing sensitive data like database passwords with Ansible Vault.
- Container Management: Deploying and managing multi-container applications directly with Ansible's native Docker modules, bypassing the need for the
docker-composelibrary.
- Automation/Configuration Management: Ansible
- Containerization: Docker
- Application: WordPress
- Database: MySQL
- Base OS: Debian 12
The project is organized into three main roles:
common: Handles basic server setup, like updating packages, configuring DNS, and installing essential/build tools.docker: Installs and configures Docker Engine and its Python SDK dependencies.wordpress: Deploys the WordPress and MySQL containers using Ansible'sdocker_containermodule and connects them via a dedicated Docker network.
- Clone this repository.
- Install Ansible and the
community.dockercollection:ansible-galaxy collection install community.docker. - Update the
inventoryfile with your server's IP and user. - Run the playbook using your vault password:
ansible-playbook -i inventory playbook.yml --ask-vault-pass