Documentation Question

As I’ve been exploring Ansible, I sometimes run into situations where I’m not sure if some certain syntax is allowed in certain situations, or conversely I’ll discover in an unrelated example some new syntax combination I’d never considered before.

So what I was wondering was whether there exists anywhere–or if there’s a way to construct–a detailed list of what keywords are available for use in which elements of the playbook/task/role syntax.

For example, in a playbook, you have a YAML list. Each item in that list must contain a “hosts:” key. Other keys are optional, and many are well-known, such as “name:”, “tasks:”, “handlers:”, “roles:”, but others are not as easily discovered, like “connection:” and “serial:”.

Similarly in tasks, there are many kinds of loops and conditionals and extra features like “register:” and “changed_when:”.

Ultimately most if not all of these are documented and generally explained well, but best I can tell there’s no reference listing all of the possible keywords for a particular section of the playbook format.

Other than the module index, the current documentation of the playbook format is all done tutorial style. Is there a reference I’m missing, or are there plans for one? I’d be happy to try to contribute to such an effort, though I wouldn’t know where to start building something like this.

Thanks.

-dave

Yep,

What you are asking for about what is a keyword in a play, or a task, etc, is quite a good idea, and something I would like to do.

Not really documented in the way you were looking for AFAIK, but the list of valid keys can be found on a relatvely easy place in the code:

https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/play.py#L42

and

https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/task.py#L38

HTH,

Serge

Thanks Serge,
I’ve already learned something just from glancing through those lists! :slight_smile: