| Action | Command | Details |
|---|---|---|
| Check Ansible version | ansible --version |
Display installed Ansible version. |
| Ping all hosts | ansible all -m ping |
Test connectivity to all hosts. |
| Run ad-hoc command | ansible all -m shell -a 'uptime' |
Run shell command on all hosts. |
| Run playbook | ansible-playbook playbook.yml |
Execute an Ansible playbook. |
| List inventory hosts | ansible-inventory --list |
Show all hosts from inventory. |
| Check syntax | ansible-playbook playbook.yml --syntax-check |
Validate playbook syntax. |
| Gather facts | ansible all -m setup |
Collect system information from hosts. |
| Limit hosts | ansible-playbook playbook.yml --limit webservers |
Run playbook on limited hosts. |
| Check diff mode | ansible-playbook playbook.yml --diff |
Show changes made by playbook. |
| Start interactive shell | ansible-console |
Open interactive Ansible shell. |