ansible-doc
ansible-doc is like a man/help command in ansible.
Running adhoc commands with ansible
An ad hoc command is a way of executing single ansible task.
Ad hoc command execution are runtime based ; which means that it is a command line execution and is not saved in storage (File).
Ad hoc commands are very useful for performing simple tasks with ansible in no time.
Command line Syntax:-
Syntax:-
ansible hostname –m module -a module arguments -i inventoryfile
The hostname argument is used to specify the managed hosts on which the ad hoc command should execute.
The -m option takes the name of the module as an argument which the ansible should run on the target nodes. Modules are programs that are executed to implement your task.
The -a option is called module arguments which are enclosed with quotes.
Some module has no additional arguments ( ex: ping ).
Modules are the tools that ad hoc commands use to complete tasks. Ansible provides hundreds of modules , each for a specific purpose.
To get list of ansible module, we can use command called ansible-doc -l
To get module documentation, we can use ansible-doc <modulename>
To learn more about modules, access the online Ansible documentation at
http://docs.ansible.com/ansible/2.7/modules/modules_by_category.html
Conclusion
So far we discussed about how to get list of ansible modules and module documentations..