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 infra
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r ansible/requirements.txt --force-reinstall
cd ansible
ansible-galaxy install -r requirements.yml --force
cd ..
ansible --version
ansible-lint --version
yamllint --version
Before 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
Manages Proxmox virtualization hosts:
export OP_CREDENTIAL="op://Private/onkb65jhnceyyid7ope2zg5s2m/credential"
cd ansible
op run -- ansible-playbook -i ./inventory.yml ./proxmox_nodes.yml
Hogsmeade Host:
export OP_CREDENTIAL="op://Private/onkb65jhnceyyid7ope2zg5s2m/credential"
cd ansible
op run -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml
Home Gateway (ER-X):
export OP_CREDENTIAL="op://Private/onkb65jhnceyyid7ope2zg5s2m/credential"
cd ansible
op run -- ansible-playbook -i ./inventory.yml ./home-gateway.yml
MacBook (sebastian-mba):
export OP_CREDENTIAL="op://Private/onkb65jhnceyyid7ope2zg5s2m/credential"
cd ansible
op run -- ansible-playbook sebastian-mba.yml --ask-become-pass
Flightradar Host:
export OP_CREDENTIAL="op://Private/onkb65jhnceyyid7ope2zg5s2m/credential"
cd ansible
op run -- ansible-playbook -i ./inventory.yml ./flightradar.yml
To test playbooks without making changes, add the --check
flag:
cd ansible
op run -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml --check
For detailed execution information, use verbose flags:
cd ansible
op run -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml -v # verbose
op run -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml -vv # more verbose
op run -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml -vvv # debug
The 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 -d
The terraform/
directory contains Terraform configurations for cloud infrastructure, primarily Cloudflare DNS management.
cd terraform
terraform init
terraform plan
terraform apply
Ansible Lint:
cd ansible
ansible-lint
YAML 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"
cd ansible
# Test syntax only
ansible-playbook --syntax-check -i ./inventory.yml ./hogsmeade.yml
# Run against single host
op run -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml --limit hogsmeade --check
# Run specific tags
op run -- ansible-playbook -i ./inventory.yml ./hogsmeade.yml --tags "docker"
- 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
- 1Password CLI issues: Ensure you're logged in with
op signin
# 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.