ansible-lab is a pet project to practice Ansible and Vagrant. It provisions a simple environment with:
- DB VM: PostgreSQL database server
- App VM: Simple application environment with Python script for DB connectivity check and static HTML page
This project demonstrates practical Ansible skills for SRE/DevOps interviews, focusing on infrastructure automation and configuration management.
Note: The project does not use the outdated vagrant-vbguest plugin due to Ruby compatibility issues. Provisioning is handled fully via Vagrant and Ansible.
ansible-lab/
├── ansible.cfg
├── .gitattributes
├── .gitignore
├── .github/workflows/pipeline.yml
├── inventory.yml
├── ping.yml
├── playbook.yml
├── README.md
├── roles/
│ ├── app/
│ │ ├── files/index.html
│ │ ├── tasks/main.yml
│ │ └── templates/check_db.py.j2
│ └── db/
│ └── tasks/main.yml
├── .vagrant/
│ ├── machines/
│ │ ├── app/virtualbox/vagrant_cwd
│ │ └── db/virtualbox/vagrant_cwd
│ └── rgloader/loader.rb
└── Vagrantfile
- Ansible Automation: Multi-server provisioning using roles and playbooks
- Vagrant Infrastructure: VM management with private networking
- CI/CD Integration: GitHub Actions for syntax validation
- Configuration Management: YAML-based infrastructure as code
-
Clone the repository:
git clone https://github.com/DanLinX2004X/ansible-lab.git cd ansible-lab -
Start Vagrant VMs:
vagrant up
-
Check Ansible syntax (CI also covers this):
ansible-playbook --syntax-check playbook.yml
-
Verify connectivity:
ansible all -i inventory.yml -m ping
Pipeline triggers on push and pull_request events:
- Ansible playbook syntax check
- Vagrantfile Ruby syntax check
- YAML validation (warnings don't fail pipeline)
- Ansible: Playbooks, roles, inventory management
- Vagrant: Multi-VM environments, networking
- YAML: Configuration as code
- CI/CD: Automated testing with GitHub Actions
- Infrastructure Automation: End-to-end provisioning
DanLinX2004X
MIT License - LICENSE check for details