# Dictionary parameters to custom modules

**URL:** <https://forum.ansible.com/t/dictionary-parameters-to-custom-modules/12143>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [December 18, 2012, 12:14am UTC](https://forum.ansible.com/t/dictionary-parameters-to-custom-modules/12143 "2012-12-18T00:14:54Z")\
**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:** [December 18, 2012, 12:14am UTC](https://forum.ansible.com/t/dictionary-parameters-to-custom-modules/12143/1 "2012-12-18T00:14:54Z")

</div>

It is true that modules can generally only take key=value arguments.

What is the nature of the module you are writing? I am generally not  
in favor of the idea of modules needing to read a config file and do  
not want that to become common, but it may serve as a workaround in  
your case.

---

<div class="post-metadata">

**Author:** ![Oren\_Shomron](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@Oren\_Shomron](https://forum.ansible.com/u/Oren_Shomron)\
**Post date:** [December 18, 2012, 4:49pm UTC](https://forum.ansible.com/t/dictionary-parameters-to-custom-modules/12143/2 "2012-12-18T16:49:55Z")

</div>

I was trying to write a module to preseed configuration settings for debconf. I was hoping to get away with simple key=value, but each key in debconf has a type as well.

I saw that if I don’t inherit any of the AnsibleModule code, I can go straight to the parameters file and parse the json myself, but it is a bit of a hassle.

Otherwise, like you said, I need to use template to create a preseed file, and then feed that into debconf as a separate step.

---

<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:** [December 19, 2012, 1:43am UTC](https://forum.ansible.com/t/dictionary-parameters-to-custom-modules/12143/3 "2012-12-19T01:43:57Z")

</div>

Yeah I debated JSON parameters to modules at one point, but decided  
against. The idea of having structured parameters in the YAML made  
it somewhat verbose.

You're correct on the raw string hack, at least for now.
