Alternate key/value inputs discussion (for 1.1)

We talked a bit earlier about the need to pass complex variables
(nested, etc) to some modules and making things so that some modules
could accept JSON.

Given this, I'm pondering also allowing this syntax, in addition to
the easy one we now have:

- name: foo
  action:file
  inputs:
      src: /etc/motd
      mode: 0644

etc

For cases like the CloudFormations suggestion, it would also accept

- name: foo
  action: file
  inputs: $var

and of course the $var datastructure can contain $variables

Technically I think you should also be able to mix things:

- name: foo mode=066
  action: file
  inputs: $var

Again, we have to implement some minor checking to make sure an older
non-ansible-module-common-using module can grok JSON inputs, which
will probably be some sort of flag or something needing to be in the
module.

#JSON_INPUTS=True (or something)

Which actually makes Ruby or Perl modules (not that anyone would want
these! :)) *easier* to write.

For modules using the python module infrastructure, it would "just work".

Obviously this is more verbose, and I like concise, so I don't think
this would become a trend or best practice, but it's probably also not
a "bad practice" either, for those that want to see very small diffs
in their config management history.

--Michael

Is that proposed as an equivalent to:

  • name: foo
    action: file src=/etc/motd mode=0644

If so, I suggest to call it ‘args’ instead of ‘inputs’, to be consistent with the command line option ‘-a/–args’ of ansible.

Yes -- I agree!