Technically, we have already run our first ad-hoc command in ansible in our previous post. In this post we will actually understand the command we ran. Since this is the format we in fact use through out our entire Ansible journey, it is good to understand this clearly.
Let’s take a look at the command we ran and output we got. Going by each word below
ansible -> keyword to execute ansible commands
all -> here we can either mention a machine in the inventory against which the modules needs to be executed or just mention all to run against all of them.
-i -> Short for –inventory-file, used to specify the inventory file with managed nodes
-u -> Short for –user, used to specify the remote user name, the default user is vagrant
-m -> Short for –module-name, used to specify the module
-k -> Short for –ask-pass, used to prompt the user for password when executed. Look we actually entered the password.
-v -> Short for –verbose, used for troubleshooting ssh, use -vvv for detailed information.
The keyword success in the output is self explanatory. “changed” field is the one that needs to be monitored if we actually change anything using our modules. Here we used ping module which basically changes no configuration and hence it is false in our case. pong is the response for ping module – meaning all good.
Hope this was informative. Thanks!