/run-ansible -- Run an Ansible Playbook
Trigger
User asks to run an Ansible playbook, deploy an application, or configure infrastructure.
Workflow
- •
Identify the playbook. Available playbooks in
ansible/:Playbook Purpose app.yamlDeploy application site.yamlFull site deployment k8s-setup.yamlKubernetes cluster setup dlt-provision.yamlDistributed ledger provisioning fabric_ca.yamlFabric Certificate Authority fabric_init.yamlFabric network initialization fabric_orderer.yamlFabric orderer nodes fabric_peer.yamlFabric peer nodes fabric_upgrade.yamlFabric version upgrade substrate_upgrade.yamlSubstrate version upgrade umbrella.yamlUmbrella Helm chart deployment debug-shell.yamlDebug shell access - •
Choose execution method:
Local execution:
bashbash run-ansible.sh ansible/<playbook> <environment> <check_mode> <verbosity>
Parameters:
- •
<playbook>: e.g.,app.yaml - •
<environment>: e.g.,default - •
<check_mode>:true(dry run) orfalse(apply) - •
<verbosity>:0-3(higher = more verbose)
CI dispatch (via GitHub Actions):
bashgh workflow run deploy.yml \ -f playbook=<playbook> \ -f environment=default \ -f check_mode=false \ -f verbosity=0
- •
- •
For dry runs, always run with check mode first:
bashbash run-ansible.sh ansible/<playbook> default true 1
- •
Monitor CI execution (if dispatched via GitHub Actions):
bashgh run list --workflow=deploy.yml --limit 5 gh run watch <run-id>
- •
Review output for errors, changed tasks, and skipped tasks.
Key Variable Files
- •
ansible/inventories/default/group_vars/all/env.yaml-- environment config - •
ansible/inventories/default/group_vars/all/version.yaml-- version tracking (triggers CI on push) - •
ansible/vars/common.yaml-- shared variables - •
ansible/vars/umbrella.yaml-- Helm chart values
Anti-patterns
- •Do not run playbooks in apply mode without user confirmation
- •Do not modify
version.yamlwithout understanding it triggers CI deployment - •Do not run destructive playbooks (upgrades) without a dry run first
- •Do not skip specifying the environment parameter
Checklist
- • Correct playbook identified
- • Execution method chosen (local vs CI)
- • Dry run completed first (for destructive operations)
- • User confirmed before applying
- • Output reviewed for errors