ansible-playbook

Run Ansible playbooks to automate multi-host configuration.

high risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
Safer / dry-run alternatives
ansible-playbook site.yml --check --diff --limit <host>Dry-run on a single host.
ansible-playbook site.yml --list-hostsSee which hosts would be targeted.
What it does

ansible-playbook executes YAML playbooks that define desired state across managed hosts. Supports tags for selective execution, limits for targeting host subsets, and check mode for dry-run previews. The --diff flag shows exactly what files will change.

Common flags
FlagMeaning
-i --inventoryInventory file or directory
--checkDry run — don't make changes
--diffShow diffs of changed files
--limitLimit execution to specific hosts/groups
--tagsOnly run tasks with these tags
--skip-tagsSkip tasks with these tags
-v/-vv/-vvvVerbosity levels
Examples
ansible-playbook site.yml -i inventory.ini --check --diffDry run with diff output · explain & risk-check →
ansible-playbook deploy.yml -i prod-inventory.ini --limit webserversRun against webservers group only · explain & risk-check →
ansible-playbook site.yml --tags nginx,sslRun only nginx and ssl tasks · explain & risk-check →
ansible-playbook site.yml -e 'app_version=1.2.3'Override variable from command line · explain & risk-check →
Pro tip

Always run with `--check --diff` before the real run in production — it shows exactly what would change without risk. Add this as a required CI step before any production ansible run.

Related
ansible ssh git
Open the full explainer →More in Terraform, Ansible & IaC

Reference text is hand-written and may be incomplete — check man ansible-playbook for your version. Test destructive commands on a non-production system first.