Ansible repository to manage the infrastructure
Find a file
2026-10-11 22:29:14 +02:00
inventories improving playbooks 2026-10-11 22:29:14 +02:00
playbooks improving playbooks 2026-10-11 22:29:14 +02:00
.ansible-lint improving playbooks 2026-10-11 22:29:14 +02:00
.gitignore improving playbooks 2026-10-11 22:29:14 +02:00
ansible-docker.sh improving playbooks 2026-10-11 22:29:14 +02:00
ansible.cfg improving playbooks 2026-10-11 22:29:14 +02:00
Dockerfile improving playbooks 2026-10-11 22:29:14 +02:00
README.md improving playbooks 2026-10-11 22:29:14 +02:00
requirements.txt improving playbooks 2026-10-11 22:29:14 +02:00
requirements.yml improving playbooks 2026-10-11 22:29:14 +02:00

ansible

Ansible repository to manage the homelab (../homelab-session-summary-*.md). Everything is reached over WireGuard, so bring the tunnel up first.

Run it from Docker

Ansible runs in a container so it never touches the laptop's own Ansible, Python or collections (ViaRézo, kubic…).

source ansible-docker.sh
ansible-docker build                       # once, and after changing requirements*
ansible-docker run                         # shell in the repo, then ansible-playbook …
ansible-docker run ansible-playbook playbooks/utils.yml -CD

The container uses the host network (for wg0) and your SSH agent, reads ~/.ssh/known_hosts without writing to it, and mounts this repo, so edits are live and kube/config lands here.

Without Docker: uv venv env && uv pip install -p env/bin/python -r requirements.txt, then env/bin/ansible-galaxy collection install -r requirements.yml -p .ansible/collections.

Inventory (inventories/hosts.yml)

Group What Connects as
hypervisors Proxmox host 10.0.0.1 root
lxc 100–106, 108–110, 250 root (110 through pct exec on the host)
vm 107 pelican-panel + the k3s VMs root, k3s nodes as un-oeil + sudo
k3s k3s_masters 131–133, k3s_workers 141–143 un-oeil + sudo
external ViaRézo VM 10.10.10.3 root

host_type (lxc, vm, proxmox, external) is what the playbooks test to treat containers and VMs differently.

Playbooks

Always dry-run first: -CD (--check --diff).

Playbook Does
utils.yml apt sources → prism.viarezo.fr, base packages, qemu-guest-agent on VMs. --tags upgrade -l <hosts>: full-upgrade one host at a time (never the Proxmox host); -e utils_reboot=true reboots VMs that need it, never LXCs.
add_user.yml Accounts from inventories/group_vars/all/users.yml: create, keys (exact list), passwordless sudo, remove. Skips system accounts of the same name (Forgejo's un-oeil).
deploy_kube.yml Longhorn prerequisites on workers, k3s install/upgrade/config one node at a time (init master → masters → workers), writes kube/config. Bump k3s_version in group_vars/k3s.yml to upgrade.

Secrets

vault/password (gitignored) holds the vault password. Nothing is vaulted yet; the k3s join token is read from the first master. kube/config is gitignored.