Ansible28 commands
Ansible Cheat Sheet
Essential Ansible commands for automation — playbooks, inventory, roles, vault, and ad-hoc commands.
Ad-Hoc Commands
| Command | Description |
|---|---|
| Ping all hosts |
| Gather facts from all hosts |
| Run shell command on all hosts |
| Copy file to group |
| Install package (Debian) |
| Start a service |
Playbooks
| Command | Description |
|---|---|
| Run a playbook |
| Run with custom inventory |
| Limit to host group |
| Run only tagged tasks |
| Skip tagged tasks |
| Dry run (check mode) |
| Show file changes |
| Pass extra variables |
Inventory
| Command | Description |
|---|---|
| List all inventory hosts as JSON |
| Show inventory tree |
| List matched hosts |
| Show host variables |
Vault
| Command | Description |
|---|---|
| Create encrypted file |
| Edit encrypted file |
| Encrypt existing file |
| Decrypt file |
| Change vault password |
| Run with vault prompt |
Roles & Galaxy
| Command | Description |
|---|---|
| Scaffold a new role |
| Install role from Galaxy |
| List installed roles |
| Install collection |