How yasos-lab/lab-deploy works
Purpose and Execution Model
This is an Ansible-based homelab infrastructure repository. It converges physical/VM hosts over SSH into role-specific states: Proxmox, network appliances, Docker service hosts, Kubernetes nodes, a Jellyfin server, and controller workstations. Primary operator entry points are bootstrap.sh and top-level playbooks such as deploy-docker-node.yml, deploy-kubernetes.yml, and config-network.yml.
Inventory, Targeting, and Secrets
inventories/hosts.yml defines host groups and nested Kubernetes control-plane/worker groups. Group and host variables provide the desired-state inputs, with shared Docker and monitoring values in inventories/group_vars/all/docker.yml and inventories/group_vars/all/monitoring.yml; per-host service choices live in inventories/host_vars/docker_node/containers.yml. Sensitive values are isolated in Vault-encrypted inventories/group_vars/all/secrets.yml, requiring a local vault password file at execution time.
Shared Host Baseline
Reusable task units establish common host capabilities before specialized services: packages/repositories, filesystems, service management, shell configuration, monitoring, backup, and remote storage mounts. The core implementation is under tasks/common/packages.yml, tasks/common/filesystem.yml, and tasks/common/monitoring.yml. This is the principal boundary between generic Linux host provisioning and workload-specific deployment.
Docker Application Platform
Docker hosts are configured through tasks/docker/docker.yml and tasks/docker/services.yml, then rendered into ordered Compose application domains. The domains include network/identity ingress, core services, monitoring, cloud, media, automation, and AI, represented by templates such as templates/docker/00-network/docker-compose.yml.j2, templates/docker/02-monitoring/docker-compose.yml.j2, and templates/docker/04-media/docker-compose.yml.j2. Traefik and Authelia configuration form the ingress/authentication edge in templates/docker/00-network/config/traefik/traefik.yml.j2 and templates/docker/00-network/config/authelia/configuration.yml.j2.
Kubernetes Cluster Bootstrap
Kubernetes is an ordered, staged deployment rather than a generic role: system preparation, packages, filesystem, virtual IP, kubeadm initialization, Cilium CNI, node joining, and verification. Stages are explicitly encoded in tasks/k8s/01-system.yml, tasks/k8s/05-kubeadm-init.yml, and tasks/k8s/08-verify-cluster.yml. Control-plane-specific and worker-specific inputs are separated in inventories/group_vars/k8s_controlplanes/main.yml and inventories/group_vars/k8s_workers/main.yml; containerd and kube-vip manifests are rendered from templates/k8s/containerd/config.toml.j2 and templates/k8s/manifests/kube-vip.yml.j2.
Network and Edge Services
Network-targeted playbooks configure router-like hosts with DNS filtering/resolution, VPN, reverse proxying, and high availability. Task boundaries are tasks/network/pihole.yml, tasks/network/unbound.yml, tasks/network/pivpn.yml, tasks/network/caddy.yml, and tasks/network/keepalived.yml. Their rendered configurations—particularly templates/network/caddy/Caddyfile.j2 and templates/network/keepalived/keepalived.conf.j2—depend on network group variables and create the edge between local clients, internal services, and external access.
Storage, Backup, and Observability Integrations
Hosts can mount remote storage through rclone and perform backups through Restic, implemented in tasks/common/rclone.yml, tasks/common/restic.yml, and associated systemd/script templates. Monitoring spans host-side agents and Dockerized Prometheus, Loki, Promtail, and Glance configuration, centered on tasks/common/glance-agent.yml, templates/docker/02-monitoring/config/prometheus/prometheus.yml.j2, and templates/docker/02-monitoring/config/loki/loki-config.yml.j2. Jellyfin is both a standalone node path and a media-platform workload, with common installation tasks in tasks/common/jellyfin.yml.
Main entry points: bootstrap.sh Bootstrap & deploy playbooks · packages.yml Common host baseline · docker.yml Docker host setup · hosts.yml Host inventory
Components 19
Inventory & Desired State
- Host inventory · Defines host groups and Kubernetes control-plane and worker targeting.
inventories/hosts.yml - Shared service variables · Supplies shared Docker and monitoring desired state.
inventories/group_vars/all/docker.yml - Docker host services · Selects per-host container services.
inventories/host_vars/docker_node/containers.yml - Vault secrets · Requires a local vault password at runtime.
inventories/group_vars/all/secrets.yml
Ansible Automation
- Bootstrap & deploy playbooks · Bootstrap and role-specific playbooks drive convergence over SSH.
bootstrap.sh - Common host baseline · Provisions packages, filesystems, monitoring, service management, backups, and mounts.
tasks/common/packages.yml - Remote storage & backup · Mounts remote storage and configures Restic backups.
tasks/common/rclone.yml
Docker Platform
- Docker host setup · Installs Docker and deploys configured services.
tasks/docker/docker.yml - Compose application domains · Ordered network, core, monitoring, cloud, media, automation, and AI domains.
templates/docker/00-network/docker-compose.yml.j2 - Traefik & Authelia · Provides reverse proxying and authentication for Docker services.
templates/docker/00-network/config/traefik/traefik.yml.j2 - Docker observability stack · Prometheus, Loki, Promtail, and Glance configuration.
templates/docker/02-monitoring/config/prometheus/prometheus.yml.j2
Kubernetes Bootstrap
- Kubernetes system preparation · Prepares nodes before cluster initialization.
tasks/k8s/01-system.yml - Kubeadm control plane · Initializes the cluster control plane.
tasks/k8s/05-kubeadm-init.yml - CNI, VIP & node joining · Renders containerd and kube-vip, installs Cilium, and joins nodes.
templates/k8s/manifests/kube-vip.yml.j2 - Cluster verification
tasks/k8s/08-verify-cluster.yml
Network Edge
- Network services · Configures DNS filtering/resolution, VPN, reverse proxy, and HA.
tasks/network/pihole.yml - Caddy & Keepalived · Provides reverse proxying and high-availability virtual addressing.
templates/network/caddy/Caddyfile.j2
Other components
- Operator
- Homelab hosts · Proxmox, network appliances, Docker hosts, Kubernetes nodes, Jellyfin, and workstations.
Connections 24
- Operator → Bootstrap & deploy playbooks: runs
- Bootstrap & deploy playbooks → Host inventory: targets
- Bootstrap & deploy playbooks → Vault secrets: loads
- Host inventory → Shared service variables: resolves variables
- Host inventory → Docker host services: resolves host choices
- Bootstrap & deploy playbooks → Common host baseline: applies
- Common host baseline → Remote storage & backup: includes
- Common host baseline → Docker host setup: precedes
- Shared service variables → Docker host setup: configures
- Docker host services → Docker host setup: selects services
- Docker host setup → Compose application domains: renders and deploys
- Compose application domains → Traefik & Authelia: includes network edge
- Compose application domains → Docker observability stack: includes monitoring
- Common host baseline → Kubernetes system preparation: precedes
- Kubernetes system preparation → Kubeadm control plane: prepares for
- Kubeadm control plane → CNI, VIP & node joining: enables
- CNI, VIP & node joining → Cluster verification: completes
- Bootstrap & deploy playbooks → Network services: applies
- Network services → Caddy & Keepalived: renders
- Common host baseline → Homelab hosts: converges
- Docker host setup → Homelab hosts: configures Docker hosts
- Cluster verification → Homelab hosts: validates cluster nodes
- Network services → Homelab hosts: configures edge hosts
- Caddy & Keepalived → Traefik & Authelia: routes external access