- Déglon Matthieu
- Killyan Batailler
- Ansible 2.9 or newer
- SSH access to Debian-based servers
- SSH agent with your private key loaded
Check if your SSH key is added:
ssh-add -l
If not, add it:
ssh-add ~/path/to/your/ssh_key
ansible-galaxy collection install community.general
ansible-galaxy collection install community.mysql
ansible-galaxy collection install -r requirements.yml
Use the provided Makefile
commands for quick deployment.
make setup
make deploy
make deploy.webservers
make deploy.dbservers
make deploy.staging
make deploy.production
make deploy.nginx
make deploy.php
make deploy.mariadb
make deploy.webapp
SSH into a server and run:
systemctl status php8.2-fpm
systemctl status mariadb
mysql -u root -p
SHOW DATABASES;
From a browser, visit the IP address of one of the servers.
Run the following from the inventory/
directory:
ansible -i hosts.yml all -m ping
Expected output:
server-01 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
server-02 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
.
├── Makefile # Installation and deployment commands
├── requirements.yml # List of Galaxy roles (empty for now)
├── inventory/
│ └── hosts.yml # Host inventory (staging & production)
├── roles/ # Ansible roles
│ ├── nginx/
│ │ ├── tasks/main.yml # NGINX installation and configuration
│ │ ├── handlers/main.yml # Handler for NGINX reload
│ │ └── templates/
│ │ └── nginx.conf.j2 # NGINX site template
│ ├── php/
│ │ ├── tasks/main.yml # PHP-FPM installation and configuration
│ │ └── handlers/main.yml # Handler for PHP-FPM restart
│ ├── mariadb/
│ │ └── tasks/main.yml # MariaDB installation, securing, DB/user creation
│ └── webapp/
│ ├── tasks/main.yml # PHP app deployment + connection template
│ ├── files/index.php # Simple Hello World PHP
│ └── templates/
│ └── db_connect.php.j2 # DB connection test script template
├── playbooks/
└──group_vars/
│ all.yml # Common variables
│ ├── staging/
│ │ ├── php.yml # PHP limits for staging
│ │ ├── db.yml # User/database names for staging
│ │ └── vault.yml # Encrypted variables for staging (DB passwords)
│ └── production/
│ ├── php.yml # PHP limits for production
│ ├── db.yml # User/database names for production
│ └── vault.yml # Encrypted variables for production (DB passwords)
│ ├── main.yml # Main playbook (all services)
│ ├── webservers.yml # Web-only playbook
│ └── dbservers.yml # DB-only playbook
└── README.md # Project documentation
- Ansible
- Nginx
- PHP 8.2
- MariaDB
- Debian
The documentation and comments have been written with the assistance of artificial intelligence, Claude.
This project is licensed under the MIT License.