Skip to content

sapsan14/ansible-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Home Lab (Fresher Project)

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.

What this project shows

  • Inventory management with hosts.ini
  • Role-based structure via the web role (tasks, handlers, vars, templates)
  • Idempotent playbook execution with site.yml

Prerequisites

  • Ansible installed on your control machine
  • SSH access to your target host(s)
  • Python available on managed nodes (standard for most Linux distros)

Project layout

ansible-project/
├─ hosts.ini
├─ site.yml
└─ roles/
   └─ web/
      ├─ tasks/main.yml
      ├─ handlers/main.yml
      ├─ vars/main.yml
      └─ templates/index.html.j2

Inventory example (hosts.ini)

[web]
your.web.host ansible_user=your_user

Replace your.web.host and your_user with your target host and SSH user.

Playbook (site.yml)

The root playbook applies the web role to hosts in the web group.

Role: web

  • Installs and configures a simple web server
  • Deploys an index.html from the Jinja2 template templates/index.html.j2
  • Uses variables from vars/main.yml

How to run

ansible-playbook -i hosts.ini site.yml

Add -K if privilege escalation is required, or -k/--ask-pass if you use password auth.

Customization

  • Update roles/web/vars/main.yml to change the page title or content.
  • Modify roles/web/templates/index.html.j2 for custom markup or styling.

Troubleshooting

  • Verify SSH connectivity: ansible -i hosts.ini web -m ping
  • Increase verbosity: add -vvv to commands for detailed logs

Notes

  • 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages