ansible all -m copy -a 'src=/etc/hosts dest=/etc/hosts' -b
Copy a local file to every managed host
Pushes the local /etc/hosts file to the same path on all targets using the copy module with -b for write permission. The module transfers only when content differs, keeping repeated runs fast. Related: ansible all -m command.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.