This commit is contained in:
lif
2025-10-10 17:47:09 +01:00
commit 520fef57a1
10 changed files with 1302 additions and 0 deletions

263
README.md Normal file
View File

@@ -0,0 +1,263 @@
# Bare Bones Vagrant Setup
A **ultra-lightweight** Vagrant setup with 4 machines and a host for basic testing and development.
## ⚡ Ultra-Lightweight Features
- **512MB RAM per machine** - Minimal memory footprint
- **Debian Linux base** - ~150MB base image, ~400MB with tools
- **No provisioning scripts** - Pure Debian base
- **No shared folders** - Disabled for performance
- **Minimal network** - Just basic connectivity
- **Fast startup** - Debian boots quickly
## 🏗️ Architecture
```
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ host │ │ machine1 │ │ machine2 │ │ machine3 │
│ 192.168.56.1│ │192.168.56.10│ │192.168.56.11│ │192.168.56.12│
│ │ │ │ │ │ │ │
│ - Host │ │ - Machine 1 │ │ - Machine 2 │ │ - Machine 3 │
│ - Gateway │ │ - Debian │ │ - Debian │ │ - Debian │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
┌─────────────┐
│ machine4 │
│192.168.56.13│
│ │
│ - Machine 4 │
│ - Debian │
└─────────────┘
```
## 📋 Prerequisites
- **Vagrant** 2.2+
- **VirtualBox** 6.0+ or **libvirt** (KVM)
- **3GB+ RAM** (512MB per machine)
- **4GB+ free disk space**
## 🚀 Quick Start
1. **Start all machines:**
```bash
make start
```
2. **Check status:**
```bash
make status
```
3. **Access a machine:**
```bash
make ssh-host
make ssh-machine1
```
## 🎛️ Management Commands
### Using Make
```bash
make start # Start all machines
make stop # Stop all machines
make destroy # Destroy all machines
make status # Show machine status
make ssh-host # Access host machine
make ssh-machine1 # Access machine1
make ssh-machine2 # Access machine2
make ssh-machine3 # Access machine3
make ssh-machine4 # Access machine4
```
### Using Management Script
```bash
./manage.sh start # Start all machines
./manage.sh stop # Stop all machines
./manage.sh destroy # Destroy all machines
./manage.sh status # Show machine status
./manage.sh ssh host # Access host machine
./manage.sh ssh machine1 # Access machine1
```
### Using Vagrant Directly
```bash
vagrant up # Start all machines
vagrant halt # Stop all machines
vagrant destroy -f # Destroy all machines
vagrant status # Show machine status
vagrant ssh host # Access host machine
vagrant ssh machine1 # Access machine1
```
## 🌐 Network Configuration
- **Host**: 192.168.56.1
- **Machine 1**: 192.168.56.10
- **Machine 2**: 192.168.56.11
- **Machine 3**: 192.168.56.12
- **Machine 4**: 192.168.56.13
All machines are connected via a private network and can communicate with each other.
## 🔧 Machine Specifications
- **OS**: Debian 11 (Bullseye)
- **RAM**: 512MB per machine + 1GB swap
- **CPU**: 1 core per machine
- **Disk**: 8GB per machine
## 📁 Project Structure
```
test-vagrant/
├── Vagrantfile # Debian Linux cluster configuration
├── manage.sh # Management script
├── Makefile # Make targets
├── inventory # Ansible inventory file
├── setup-playbook.yml # Setup playbook (dependencies, Python, swap)
├── deploy-playbook.yml # Deployment playbook (apps, services)
├── README.md # This file
└── .gitignore # Git ignore rules
```
## 🛠️ Troubleshooting
### Common Issues
1. **Machines not starting:**
```bash
vagrant status
vagrant up --debug
```
2. **Network issues:**
```bash
vagrant ssh host -c "ping 192.168.56.10"
```
3. **SSH issues:**
```bash
vagrant ssh-config
```
### Useful Commands
```bash
# Check machine status
vagrant status
# View machine details
vagrant ssh-config
# Reload machines
vagrant reload
# Provision machines
vagrant provision
```
## 🐧 Debian Linux Notes
### **Package Management**
```bash
# Update package index
apt update
# Install packages
apt install package-name
# Search packages
apt search keyword
```
### **Common Debian Commands**
```bash
# Check system info
uname -a
cat /etc/os-release
# Check memory usage
free -m
# Check disk usage
df -h
```
## 🎭 Ansible Integration
### **Prerequisites**
```bash
# Install Ansible (on your host machine)
pip install ansible
# Or on Ubuntu/Debian
sudo apt install ansible
```
### **Ansible Commands**
```bash
# Test connectivity to all hosts
make ansible-ping
# Install dependencies (Python, tools, swap)
make ansible-setup
# Deploy applications and services
make ansible-deploy
# List all hosts
make ansible-list
# Gather system facts
make ansible-facts
```
### **Using Management Script**
```bash
# Test Ansible connectivity
./manage.sh ansible ping
# Install dependencies
./manage.sh ansible setup
# Deploy applications
./manage.sh ansible deploy
```
### **Direct Ansible Commands**
```bash
# Test connectivity
ansible all -i inventory -m ping
# Run setup playbook
ansible-playbook -i inventory setup-playbook.yml
# Run deployment playbook
ansible-playbook -i inventory deploy-playbook.yml
# Run on specific hosts
ansible-playbook -i inventory deploy-playbook.yml --limit machines
# Run with verbose output
ansible-playbook -i inventory deploy-playbook.yml -v
```
## 🚀 Next Steps
This is a bare-bones Debian setup. You can extend it by:
1. **Adding provisioning scripts** to install Debian packages
2. **Setting up networking** between machines
3. **Installing Docker** (Debian has excellent Docker support)
4. **Adding lightweight services** (nginx, redis, etc.)
5. **Setting up monitoring** with lightweight tools
## 📄 License
This project is licensed under the MIT License.
---
**Ultra-Lightweight Debian! 🐧⚡**