This rule recommends reordering key names in ansible content to make code easier to maintain and less prone to errors.
Here are some examples of common ordering checks done for tasks and handlers:
name
must always be the first key for plays, tasks and handlersaction
should be the second key, just aftername
- when present, the
block
key must be the last, avoid accidental indentation bugs moving keys betweenblock
and the last task within the block.
---
- hosts: localhost
name: This is a playbook # <-- name key should be the first one
tasks: []
---
- name: This is a playbook
hosts: localhost
tasks: []