Other than web documentation, is there a command line way to access a list of all the available general playbook keywords similar to what the 'ansible-doc' command does for modules & their options, and how 'ansible-config dump' does it for ansible.cfg options?
You have the "in-system" documentation provided by the `ansible-doc` RPM.
You have your HTML versions too, if you find that useful...
That's not completely true.
It seems that since ansible-doc inclusion in ansible package the rst and html documentation in not installed anymore.
I was looking for the same answer some days ago and this is all that i found, but if you have better answer...you are welcome :)
I'm asking about generic play keywords like
My question might be trivial but I'm trying to understand how complete the "in-system" documentation is. Seems we get keyword/option docs for the ansible.cfg and modules but not for the paybook keywords themselves
I found my way here searching for an answer to this question whilst studying for the EX294 exam.
I know this thread is a year old but I thought I would update with the answer so it might help someone else.
$ ansible-doc --type keyword --list
A quick follow up:
I see now that this option is in RHEL 8.6 & ansible-core-2.12 but appears to not be in RHEL 8.4 and ansible-2.9. So still a problem for the current exam which uses RHEL 8.4.
I guess you could use:
ansible-doc [module name] | grep EXAMPLES -n50
this should give you a playbook example,
But to get a list of modules that you can use, there is nearly 3000 modules...(just under I beleive) https://docs.ansible.com/ansible/2.9/modules/list_of_all_modules.html so best to use the basic ones first:
user, service, yum (apt,dnf,gem,pip,package), firewalld, reboot, file, copy, lineinfile, get-url, nmcli and uri.
I honestly don't know if it captures everything but I definitely see most of them when running the following:
grep -R -i -E "\s+_\w+ \=" /usr/lib/python3.10/site-packages/ansible/playbook/* -o | sed 's/\s_//g' | tr -d = | uniq
grep -R -i -E "\s+_\w+ \=" /usr/lib/python$(python -c 'import sys; print(str(sys.version_info)+"."+str(sys.version_info))')/site-packages/ansible/playbook/* -o | sed 's/\s_//g' | tr -d = | uniq
ansible-doc -t module my_module_name
A collaborative learning environment, enabling open source skill development.