Ansible Cheatsheet
August 05, 2023 —
Gregg Szumowski
Ping all hosts:
$ ansible all -i hosts -m ping
Ping a specific host:
$ ansible raspberry-pi -m ping
Check uptime on all hosts:
$ ansible -m shell -a 'uptime' all
Check uname on all hosts:
$ ansible -m shell -a 'uname -a' all
Run playbook on more than one host:
$ ansible-playbook playbook1.yml -l 'host1.com,host2com'
Enable Debug and Increase Verbosity in Ansible
$ ANSIBLE_DEBUG=true ANSIBLE_VERBOSITY=4 ansible-playbook playbook.yml