Advertisement

Google Ad Slot: content-top

Common Options for Ad-hoc Commands


-i <inventory_file> : Specify a custom inventory file.


ansible all -m ping -i custom_inventory


-b (or --become) : Run commands with elevated privileges (i.e., sudo).


ansible all -m apt -a "name=nginx state=present" -b


-u <user> : Specify a remote user to use for SSH connections.


ansible all -m ping -u ansible_user


--limit <hosts> : Limit the command to a specific host or group.


ansible all -m ping --limit webserver1