Ansible Quick-Start Checklist
This page provides a concise onboarding guide. It complements the Ansible Overview & Usage and Directory Structure & Conventions by serving as a oneβpage reference for essential commands.
Checking Out the Code from GitHub
Before working with Ansible, clone the repository and keep it up to date:
# Clone the repository (first time)
git clone https://github.com/t3knoid/ansible.git
cd ansible
# Update to the latest version (subsequent use)
git pull
Notes:
- Always run
git pullbefore executing playbooks to ensure you are working with the latest codebase. - For contributions, create a feature branch before making changes:
git checkout -b feature/my-change
Environment Setup
- Connect to a control node (e.g., via SSH).
- Activate Python environment:
source /opt/python_3.12/bin/activate - Navigate to the Ansible repository:
cd ~/ansible - Update to the latest codebase:
git pull -
Create vault password file (.vault_pass.txt)
Create the file ~/.vault_pass.txt. Paste the vault password in this file and save it.
vi ~/.vault_pass.txt
Deploy or Update Ansible
Run the following command to deploy or update Ansible:
INV=inventory/ansible/inventory.ini
ansible-playbook -k -i $INV playbooks/ansible/deploy_ansible.yml
Test Ansible
ansible -k all -i 127.0.0.1, -m ping
This should get the following response when successful.
127.0.0.1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
Common Playbooks
| Playbook | Purpose |
|βββ-|βββ|
| provision_vm.yml | Provision a new virtual machine |
| deploy_code_server.yml | Deploy Code Server IDE |
Privileged Execution
- Use the local ansible account during VM provisioning.
- After provisioning, any user in the ansible domain group can elevate privileges to run Ansible commands.
Alternative Execution via Semaphore UI
π‘ As an alternative to running playbooks from the console, you can use Semaphore UI for a simplified web interface. It provides a dashboard for managing inventories, credentials, and playbook runs.
Quick Reference Diagram
Workflow:
Clone Repo β SSH β Activate Python β Pull Repo β Run Playbook β (Optional) Manage via Semaphore UI