This repository contains a simple, fresher-friendly Ansible home lab project. It demonstrates how to provision a basic web role that serves a minimal HTML page using configuration driven by variables and templates.
- Inventory management with
hosts.ini - Role-based structure via the
webrole (tasks, handlers, vars, templates) - Idempotent playbook execution with
site.yml
- Ansible installed on your control machine
- SSH access to your target host(s)
- Python available on managed nodes (standard for most Linux distros)
ansible-project/
├─ hosts.ini
├─ site.yml
└─ roles/
└─ web/
├─ tasks/main.yml
├─ handlers/main.yml
├─ vars/main.yml
└─ templates/index.html.j2
[web]
your.web.host ansible_user=your_userReplace your.web.host and your_user with your target host and SSH user.
The root playbook applies the web role to hosts in the web group.
- Installs and configures a simple web server
- Deploys an
index.htmlfrom the Jinja2 templatetemplates/index.html.j2 - Uses variables from
vars/main.yml
ansible-playbook -i hosts.ini site.ymlAdd -K if privilege escalation is required, or -k/--ask-pass if you use password auth.
- Update
roles/web/vars/main.ymlto change the page title or content. - Modify
roles/web/templates/index.html.j2for custom markup or styling.
- Verify SSH connectivity:
ansible -i hosts.ini web -m ping - Increase verbosity: add
-vvvto commands for detailed logs
- This is intentionally minimal to suit a fresher-level home lab. Expand it by adding more roles, handlers, templates, and CI as you grow comfortable with Ansible.