Ok, so yeah. I see the need for this in cases like yours.
I want to do this, and we mainly have to work out a syntax and such --
but also a way that keeps ansible working as it does now, doesn't
break anything, and is also easy to understand. Not hard though.
The module parsing code in AnsibleModuleCommon currently parses a
key=value command line, basically as fed directly from the task line
in Ansible. This is just a flat string now, and for existing modules
would remain so.
However, I have no problem with Ansible being smart and teaching
AnsibleModuleCommon to understand how to parse JSON inputs, with the
understanding that this will be sent only for AnsibleModuleCommon
Python-coded ansible modules that specify a specific flag that they do
allow structured data, because we don't want to break anyone else.
ACCEPTS_STRUCTURED_DATA=True or something is one easy way to do it.
It could even possibly detect that the input was JSON because it
started with a "{". (Then the module could just
deal with it, and then all of the new style modules could just take JSON)
When this is done, it would probably need to look like this to be
acceptable to me syntax wise for passing in a hash:
- task: whatever
inputs: $data
Where data could be an inline YAML datastructure or a reference to a
Ansible variable.
aka also:
- tasks: whatever
inputs:
- blarg
- foo: x
bar: $xyz
As you saw above, the one thing people are going to try though is
structured data that CONTAINS references to Ansible data though, so we
have to walk the hash and Ansible-template all the strings that
contain dollar signs, more or less. This would need to be a function
in utils.
For tasks that support structured data, they would work with the new
"inputs:" but the shorthand of the old key=value way would still work
to send them a basic flat hash.
Finally, the inputs keyword would need to work for older modules too,
in that if a hash was given that was only one level deep it just maps
to key=value entries.
So, that is the technical way forward, it's not even really that
involved (if just a little confusing), and would be accepted.
Let me know if that makes sense :).