This repository contains Ansible playbooks, Docker Compose configurations, and Terraform configurations for managing infrastructure across multiple environments.
- Git
- Python
- 1Password CLI (for credential management)
git clone https://github.com/sebdanielsson/infra.git
cd infrauv venv
source .venv/bin/activateuv pip install -r ansible/requirements.txt --force-reinstallansible-galaxy install -r ansible/requirements.yml --forceansible --version
ansible-lint --version
yamllint --versionBefore running playbooks, ensure you have:
- 1Password CLI configured with access to the required credentials
- SSH access to target hosts configured
- Inventory file (
ansible/inventory.yml) updated with your hosts - Group variables in
ansible/group_vars/configured for your environment
Hogsmeade Host:
dotenvx run -f .env -f .env.hogsmeade -- ansible-playbook -i ./inventory.yml ./hogsmeade.ymlFlightradar Host:
dotenvx run -f .env -f .env.flightradar -- ansible-playbook -i ./inventory.yml ./flightradar.ymlHome Gateway (ER-X):
dotenvx run -f .env -f .env.bpi-r4 -- ansible-playbook -i ./inventory.yml ./bpi-r4.ymlMacBook (sebastian-mba):
dotenvx run -f .env -- ansible-playbook sebastian-mba.yml --ask-become-passTo test playbooks without making changes, add the --check flag:
dotenvx run -f .env -f .env.hogsmeade -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml --checkFor detailed execution information, use verbose flags:
cd ansible
dotenvx run -f .env -f .env.hogsmeade -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml -v # verbose
dotenvx run -f .env -f .env.hogsmeade -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml -vv # more verbose
dotenvx run -f .env -f .env.hogsmeade -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml -vvv # debugThe docker/ directory contains Docker Compose configurations for various services. Each service has its own directory with a compose.yaml file.
- Media Services: Jellyfin, Sonarr, Radarr, Prowlarr, Transmission
- Infrastructure: Traefik, Portainer, Prometheus/Grafana, Nginx
- Applications: Open-WebUI, Plausible, Pocket-ID, Ombi
- Gaming: Minecraft, ET: Legacy
- Storage: MinIO
- Monitoring: Watchtower
Navigate to the service directory and use Docker Compose:
cd docker/jellyfin
docker compose up -dThe terraform/ directory contains Terraform configurations for cloud infrastructure, primarily Cloudflare DNS management.
cd terraform
terraform init
terraform plan
terraform applyAnsible Lint:
cd ansible
ansible-lintYAML Lint:
cd ansible
yamllint .- Use check mode to validate syntax and logic without making changes
- Start with a single host using
--limit hostname - Use tags to run specific tasks:
--tags "docker,security"
- Virtual environment not activated: Ensure you've activated the venv before running commands
- Missing dependencies: Re-run
pip install -r ansible/requirements.txt --force-reinstall - Ansible collections missing: Re-run
ansible-galaxy install -r ansible/requirements.yml --force - SSH connection issues: Verify SSH key authentication and host connectivity
# Test Ansible connectivity
cd ansible
ansible all -m ping -i ./inventory.yml
# Check inventory
ansible-inventory --list -i ./inventory.yml
# Test 1Password integration
op whoami- Fork the repository
- Create a feature branch
- Test your changes thoroughly
- Submit a pull request
- Sensitive data is managed through 1Password CLI integration
- SSH keys should be properly configured for target hosts
- Review playbooks in check mode before applying changes
- Keep dependencies up to date for security patches
See the LICENSE file for details.