🚀 Hands-on with Ansible Automation: Deploying Apache Using Roles
I recently worked on a small automation project using Ansible, where I created a role to deploy and configure an Apache web server in a structured and reusable way.
🔧 Project Overview
In this project, I created a role called appache that performs the following tasks:
• Installs the httpd (Apache) package
• Starts and enables the Apache service
• Copies a custom index.html file to /var/www/html/index.html
• Deploys an Apache configuration file using a Jinja2 template (node1.conf.j2)
• Places the configuration inside /etc/httpd/conf.d/node1.conf
• Uses Ansible handlers to restart the Apache service only when the configuration changes
📂 Role Structure
roles/appache
tasks/main.yml → Install package, start service, copy files
handlers/main.yml → Restart httpd when notified
templates/node1.conf.j2 → Apache configuration template
files/index.html → Web page content
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|