Syntax for providing module parameters

Many examples of tasks I see give module parameters with key=value syntax like this:

  • name: add update-motd package
    sudo: yes
    yum:
    name=update-motd
    state=present
    tags:

  • motd

  • name: install figlet for banner messages with pizazz
    sudo: yes
    yum:
    name=figlet
    state=present
    tags:

  • motd

​Personally, I prefer the second., which is more pure yamlish.

This is good to know, thanks. I kind of discovered the second syntax when studying Yaml. But most of the examples I see on the Ansible pages use name=value, which made me wonder if the name: value style was not appropriate.

Both syntaxes are valid, you see more of the key=value in the docs because it is more concise (1 line). When the module requires many arguments we tend to switch (check the cloud guides).

The truth is that the yaml syntax might be better as it avoids an extra parser.