Syntax check playbook ansible
Validate YAML syntax without executing any tasks
ansible-playbook playbook.yml --syntax-check
more ansible
all 56 commands →
Ad-hoc ping all hosts
ansible all -m ping -i inventory.ini
Run shell command on group
ansible webservers -m shell -a 'uptime && free -h' -i inventory.ini
Gather facts for a host
ansible <host> -m setup -i inventory.ini | jq '.ansible_facts | {os: .ansible_distribution, mem: .ansible_memtotal_mb}'
Check mode (dry run)
ansible-playbook site.yml --check --diff -i inventory.ini
Run with extra variables
ansible-playbook deploy.yml -e 'env=prod version=2.1.0' -i inventory.ini