Restart service on all hosts ansible
Ad-hoc service restart with privilege escalation (-b)
ansible webservers -m service -a 'name=nginx state=restarted' -b -i inventory.ini
more ansible
all 56 commands →
Show inventory graph
ansible-inventory -i inventory.ini --graph
Test role locally with Molecule
molecule test -s default
Test connectivity (ping)
ansible all -i inventory.ini -m ping
Run ad-hoc shell command
ansible webservers -i inventory.ini -m shell -a 'df -h' -b
Gather facts for a host
ansible myhost -i inventory.ini -m setup | jq '.ansible_facts.ansible_distribution'