
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 10.2K Views
List of all playbook keywords from command line like ansible-doc for modules?
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,982 Views
That will list the keywords for a specific module, not the keywords supported within a playbook


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,970 Views
1. I had the same question, mostly to save precious time while passing Ansible related Red Hat certification exams. But it looks like ansible-doc can only help with modules ("ansible-doc file") and plugins (ansible-doc -t lookup password). Beyond that, there is no command line help for Jinja2 filters - it can be found in Jinja2 documentation only, not even in the Ansible documentation.
However, ansible-lint package (automation-hub repo) contains /usr/lib/python3.6/site-packages/ansiblelint/utils.py - this Python file has all the keywords and can be helpful. For example, what do we have for "tasks"? Or, what keywords "block" has? Open utils.py with "less" and search - you'll find the hints!
2. "ansible-config dump" gets data from /usr/lib/python3.6/site-packages/ansible/config/base.yml


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,956 Views
That solution provided on Thursday, by abregman, definitely provides some (if not
all) of the keywords used in a playbook:
grep -R -i -E "\s+_\w+ \=" /usr/lib/python3.10/site-packages/ansible/playbook/* -o | sed 's/\s_//g' | tr -d = | uniq
Very elegantly done abregman!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,954 Views
Thank you, sir


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,923 Views
ansible-doc -t keyword -l > this gives list of available keywords in aplay level. Then you can get documentation for each one.
Example: ansible-doc -t keyword failed_when


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,920 Views
Thank you Khamid ,
Great, it does work in Ansible 2.13.2!
But not in Ansible 2.9 I'm using

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,883 Views
@Ken_McDonalddid you find a solution to your question? What is your reasoning for using only in-system documentation except for getting around in the exam?
- « Previous
-
- 1
- 2
- Next »