Playbook style reminder: whitespace is your friend!

I’ve noticed a lot of examples on the internet like this:

  • hosts: blarg
    tasks:
  • name: aaaaa
    foo: aaaaaa
  • name: bbbbb
    foo: bbbb
    handlers:
  • name: ccccc
    cccc: dddd
  • hosts: blarg2
    tasks:

To which, I’ll say, this is making Ansible look really rough to people that have never seen it before, and breeds bad habits.

A little whitespace between the lines helps a ton. Take a look at this by comparison:

  • hosts: blarg

tasks:

  • name: aaaaa
    foo: aaaaaa

  • name: bbbbb
    foo: bbbb

handlers:

  • name: ccccc
    cccc: dddd

  • hosts: blarg2
    tasks:

See the formatting, for instance, in some of the example content: http://github.com/ansible/ansible-examples.

I’m going to open a docs ticket to remind us to make sure all of the docs content enforces this throughout.