ansible 'web*' -m service -a 'name=nginx state=restarted' -b
Restart nginx only on hosts matching a pattern
Targets just the hosts whose names match web* and restarts the nginx service via the service module with -b for root rights. Host patterns let one command slice the inventory without editing files. Related: ansible all -m systemd.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.