Ansible Playbooks
This directory contains automation playbooks for managing the homelab infrastructure.
Provisioning & Setup
create_lxc.yml
Creates and bootstraps a new LXC container on Proxmox.
- Input: Prompts for Container Name, IP Address, VMID, CPU Cores, and Memory.
- Actions:
- Connects to Proxmox API to create a new unprivileged LXC container.
- Injects SSH Keys: Uses
vars.ymlto inject public keys directly into/root/.ssh/authorized_keys(bypassing password auth). - Starts the container and waits for connectivity.
- Automatically secures the container (creates
mbuzuser, secures SSH, disables root) effectively running the logic oflxc_setup_ubuntu.yml. - Adds the new host to
inventory/hosts.iniin the[lxc]group.
lxc_setup_ubuntu.yml
Secures a fresh Ubuntu installation.
- Target: Hosts in the
[new]group (or fresh installs). - Actions:
- Creates the administrative user (
mbuz). - Sets up SSH public key authentication.
- Disables root login and password authentication for SSH.
- Configures passwordless
sudofor the admin user. - Inventory Update: Moves the host from the
[new]group to the[lxc]group inhosts.ini.
- Creates the administrative user (
lxc_setup_ubuntu_git.yml
Provisions application dependencies on managed hosts.
- Target: Existing managed hosts (e.g.,
[lxc]). - Actions:
- Installs
gitand core utilities. - Clones the central Docker configuration repository from the local Gitea server.
- Prepares the
/opt/dockerdirectory structure.
- Installs
Maintenance & Upgrades
apt_upgrade.yml
Performs system-wide updates.
- Target: All Ubuntu hosts.
- Actions:
- Updates
aptcache. - Performs
dist-upgrade. - Autoremoves unused packages.
- Checks for and notifies if a reboot is required.
- Updates
zabbix_agent_upgrade.yml
Updates Zabbix Agent.
- Target:
zagentsgroup. - Actions:
- Ensures
zabbix-agent2is installed and updated to the latest available version.
- Ensures
zabbix_proxy_install.yml
Installs Zabbix Proxy and Agent.
- Target: Specific Zabbix Proxy host.
- Actions:
- Downloads and installs the Zabbix release package.
- Installs
zabbix-proxy-sqlite3andzabbix-agent2. - Configures PSK encryption and connection settings using
secrets.yml.