Syntax check playbook
Validate YAML syntax without executing any tasks
ansible-playbook playbook.yml --syntax-check
More ansible commands
-
ansible all -m ping -i inventory.iniCheck SSH connectivity and Python for all hosts
-
ansible webservers -m shell -a 'uptime && free -h' -i inventory.iniRun a shell command on all hosts in the webservers group
-
ansible <host> -m setup -i inventory.ini | jq '.ansible_facts | {os: .ansible_distribution, mem: .ansible_memtotal_mb}'Collect and filter Ansible facts for a single host
-
ansible-playbook site.yml --check --diff -i inventory.iniShow what would change without making any modifications
-
ansible-playbook deploy.yml -e 'env=prod version=2.1.0' -i inventory.iniOverride variables from the command line