βοΈ Ansible
Ansible is the automation framework used to manage virtual machine operations across the homelab environment. It enables:
- Provisioning of new virtual machines
- Deployment of required applications
- Configuration management of applications wherever possible
By leveraging Ansible, infrastructure tasks become streamlined, repeatable, and maintainable.
π Core Concepts
Playbooks
Each playbook defines a set of automation tasks and includes its own README.md.
A consolidated Playbook Index is available in the playbooks/ folder.
Roles
Roles modularize playbooks into reusable components and include their own README.md.
A consolidated Role Index is available in the roles/ folder.
Inventories
Inventories define the hosts and groups targeted by playbooks and include their own README.md.
A consolidated Inventory Index is available in the inventory/ folder.
π‘ For all documentation workflows, see Documenting Ansible.
π Privileged Execution (Become User)
Ansible uses a controlled privilege model:
- The local account ansible is typically used during VM provisioning.
- After provisioning, any user in the domain group ansible can elevate privileges to run Ansible commands securely.
This ensures controlled access while maintaining operational flexibility.
π₯ Control Nodes
Two Ansible control nodes orchestrate automation tasks.
For a complete guide on configuring an Ansible node, π see Configuring an Ansible Control Node
Working on a Control Node
After connecting (e.g., via SSH), initialize your environment:
source /opt/python_3.12/bin/activate
cd ~/ansible
git pull
This ensures you are working with the latest codebase and dependencies. For repository organization,
π see Ansible Directory Structure & Conventions.
π‘ Tip: Playbooks can also be executed through Semaphore UI, a web interface for managing inventories, credentials, and runs.
Deploying or Updating Ansible
To install or update Ansible on a control node:
INV=inventory/ansible/inventory.ini
ansible-playbook -k -i $INV playbooks/ansible/deploy_ansible.yml
This keeps control nodes consistent and up to date.
π Documentation Map
- Ansible Quick-Start Checklist - For onboarding with essential commands and common playbooks
- Ansible Directory Structure & Conventions - provides a detailed reference for the organization of the Ansible repository
- Semaphore - is a lightweight web interface for managing and executing Ansible playbooks
- Documenting Ansible β guides for contributing and generating playbook, role, and inventory documentation