# Alternate key/value inputs discussion (for 1.1)

**URL:** <https://forum.ansible.com/t/alternate-key-value-inputs-discussion-for-1-1/12256>\
**Category:** Ansible Project\
**Created:** [January 28, 2013, 12:30pm UTC](https://forum.ansible.com/t/alternate-key-value-inputs-discussion-for-1-1/12256 "2013-01-28T12:30:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 28, 2013, 12:30pm UTC](https://forum.ansible.com/t/alternate-key-value-inputs-discussion-for-1-1/12256/1 "2013-01-28T12:30:31Z")

</div>

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  
&nbsp;&nbsp;action:file  
&nbsp;&nbsp;inputs:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src: /etc/motd  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mode: 0644

etc

For cases like the CloudFormations suggestion, it would also accept

- name: foo  
&nbsp;&nbsp;action: file  
&nbsp;&nbsp;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  
&nbsp;&nbsp;action: file  
&nbsp;&nbsp;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

---

<div class="post-metadata">

**Author:** ![Ahmad\_Khayyat](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Ahmad\_Khayyat](https://forum.ansible.com/u/Ahmad_Khayyat)\
**Post date:** [January 28, 2013, 11:16pm UTC](https://forum.ansible.com/t/alternate-key-value-inputs-discussion-for-1-1/12256/2 "2013-01-28T23:16:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 28, 2013, 11:31pm UTC](https://forum.ansible.com/t/alternate-key-value-inputs-discussion-for-1-1/12256/3 "2013-01-28T23:31:41Z")

</div>

Yes -- I agree!
