fbpx

Working with Ad-hoc commands


Quick Points

Ad-hoc command syntax

ansible IP/ALL -m MODULE -a ARGUMENTS

User Module

ansible all -m user -a 'name=username state=present'

Yum Module

ansible all -m yum -a 'name=packagename state=present'

Service Module

ansible all -m service -a 'name=servicename state=restarted'

File Module

ansible all -m file -a 'path=/tmp/myfile state=touch'

Copy Module

ansible all -m copy -a "dest=/tmp/myfile content='some content'"

Ping Module

ansible all -m ping