Skip to content

TheQuietBlock/HomeBaseOps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HomeBaseOps

A comprehensive Infrastructure as Code (IaC) solution for homelab automation using Ansible. This project automates the configuration of servers provisioned by TerraCasa, creating a complete homelab environment with services like Minecraft servers, AdGuard DNS, and Rundeck automation.

🏗️ Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    TerraCasa Infrastructure                 │
│  ┌─────────────────────────────────────────────────────────┐│
│  │                    VLAN 20 (Server)                     ││
│  │  ┌─────────────┐ ┌─────────────┐ ┌─────────────┐        ││
│  │  │ Minecraft-1 │ │ Minecraft-2 │ │Resolver-Truth│       ││
│  │  │ 192.168.55.50│ │ 192.168.55.51│ │ 192.168.55.53│      ││
│  │  └─────────────┘ └─────────────┘ └─────────────┘        ││
│  └─────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────┘
                              │
                    ┌─────────┴─────────┐
                    │   prox-n-roll     │
                    │  (Automation)      │
                    │ 192.168.55.10      │
                    └─────────┬─────────┘
                              │
                    ┌─────────┴─────────┐
                    │      Ansible      │
                    │   Configuration   │
                    └───────────────────┘

🖥️ Servers

Server Name Purpose IP Address Resources
minecraft-java-srv001 Minecraft Java Server #1 192.168.55.50 4 CPU, 8GB RAM
minecraft-java-srv002 Minecraft Java Server #2 192.168.55.51 4 CPU, 8GB RAM
resolver-of-truth AdGuard Home DNS 192.168.55.53 4 CPU, 2GB RAM
prox-n-roll Ansible Automation Server 192.168.55.10 4 CPU, 2GB RAM

🚀 Quick Start

Prerequisites

  1. TerraCasa Infrastructure: Servers must be provisioned by TerraCasa project
  2. Automation Server: prox-n-roll server with SSH access to all target servers
  3. SSH Keys: Configured SSH key authentication from prox-n-roll to all servers

Setup Steps

  1. Clone the repository:

    git clone https://github.com/TheQuietBlock/HomeBaseOps.git
    cd HomeBaseOps
  2. Configure environment:

    cp config.template .env
    # Edit .env with your actual server IPs and configuration
  3. Update inventory:

    ./scripts/generate_inventory.sh
    # Edit ansible/inventory.ini if needed
  4. Deploy configuration:

    make all

This will:

  • Generate Ansible inventory with server IPs
  • Run Ansible playbooks to configure all services

📁 Project Structure

HomeBaseOps/
├── README.md                 # This file
├── makefile                  # Automation workflows
├── config.template           # Environment configuration template
├── scripts/                  # Helper scripts
│   └── generate_inventory.sh # Static inventory generation
├── compose/                 # Docker Compose stacks
│   ├── adguard/             # AdGuard Home (if using Docker)
│   ├── portainer/           # Portainer management
│   └── whoami/              # Example stack
└── ansible/                 # Configuration management
    ├── ansible.cfg          # Ansible configuration
    ├── playbooks/           # Playbook definitions
    ├── roles/               # Service-specific roles
    │   ├── base/            # Base system configuration
    │   ├── adguard/         # AdGuard Home setup
    │   ├── minecraft/       # Minecraft server
    │   └── rundeck/         # Automation platform
    └── group_vars/          # Group-specific variables

🔧 Makefile Commands

The project includes a convenient Makefile for common operations:

make inventory # Generate Ansible inventory
make ansible   # Run Ansible playbooks
make all       # Run complete deployment pipeline

🌐 Network Configuration

The infrastructure uses VLAN-based network segregation:

  • VLAN 10 (Home): 192.168.10.0/24 - Home network devices
  • VLAN 55 (Server): 192.168.55.0/24 - Server infrastructure (default for servers)
  • VLAN 30 (Guest): 192.168.30.0/24 - Guest network access

🔒 Security Features

  • AdGuard Home: DNS filtering and ad blocking
  • SSH Key Authentication: Passwordless access to servers
  • Network Segmentation: VLAN isolation
  • Automated Updates: Base role ensures systems are updated
  • Service Hardening: Minimal attack surface

📊 Services Overview

Minecraft Paper Servers

  • Paper Server: High-performance Minecraft server (fork of Spigot)
  • Management: Systemd service with auto-restart
  • Configuration: Customizable memory allocation (2GB default)
  • Servers: Two independent Paper servers
  • Features: Better performance, plugin support, optimizations

AdGuard Home

  • DNS Filtering: Block ads and malicious domains
  • Web Interface: Port 3000 for configuration
  • DNS Service: Port 53 for DNS queries
  • Features: Custom filtering rules and statistics

Rundeck Automation

  • Purpose: Centralized job scheduling and automation
  • Integration: Git-based job definitions
  • Monitoring: Automated deployment pipeline

🔧 Customization

Adding New Servers

  1. Update scripts/generate_inventory.sh with new server IPs
  2. Create Ansible role if needed
  3. Update ansible/playbooks/site.yml to include new server groups

Modifying Server Configuration

  • Minecraft Memory: Update minecraft_java_xmx and minecraft_java_xms in group_vars/all/main.yml
  • AdGuard Settings: Modify AdGuard configuration in the adguard role
  • Network: Adjust VLAN configurations in inventory

📚 Documentation

🐛 Troubleshooting

Common Issues

  1. Ansible Connection Failures:

    • Verify SSH key configuration from prox-n-roll server
    • Check server network connectivity
    • Ensure servers are accessible from automation server
  2. Service Startup Issues:

    • Check systemd service status: systemctl status minecraft
    • Verify AdGuard Home configuration: systemctl status AdGuardHome
    • Check firewall rules: ufw status

Logs and Debugging

# Ansible verbose output
ansible-playbook -vvv playbooks/site.yml

# Check server status
ansible all -m ping

# Check specific service logs
ansible minecraft -m shell -a "journalctl -u minecraft -f"

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

📄 License

This project is open source and available under the MIT License.

🙏 Acknowledgments

  • TerraCasa for infrastructure provisioning
  • Ansible for configuration management
  • AdGuard Home for DNS filtering
  • The open-source community for tools and inspiration

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published