# arg passed with module\_args that has whitespace, is interpreted as key value

**URL:** <https://forum.ansible.com/t/arg-passed-with-module-args-that-has-whitespace-is-interpreted-as-key-value/19816>\
**Category:** Ansible Developer\
**Created:** [November 20, 2015, 3:50pm UTC](https://forum.ansible.com/t/arg-passed-with-module-args-that-has-whitespace-is-interpreted-as-key-value/19816 "2015-11-20T15:50:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 20, 2015, 3:50pm UTC](https://forum.ansible.com/t/arg-passed-with-module-args-that-has-whitespace-is-interpreted-as-key-value/19816/1 "2015-11-20T15:50:40Z")

</div>

Hi,

I wish pass arguments to the lineinfile module, but a space in my line arg is being seen as a key / value separator

module\_args=‘dest=%s regexp=%s insertafter=%s line=%s’ % (dest, regexp, insertafter, line)

“msg”: “this module requires key=value arguments ([‘dest=/etc/ssh/sshd\_config’, ‘regexp=^PermitRootLogin’, ‘insertafter=^PermitRootLogin’, ‘line=PermitRootLogin’, ‘no’])”

— \> ‘line=PermitRootLogin’, ‘no’])"

should be

----\> ‘line=PermitRootLogin no’])"

Is there anyway I can format my string in the module\_args call, that will stop the whitespace being seen as key value seperation?

Thanks,  
Luke

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 20, 2015, 5:02pm UTC](https://forum.ansible.com/t/arg-passed-with-module-args-that-has-whitespace-is-interpreted-as-key-value/19816/2 "2015-11-20T17:02:45Z")

</div>

duh!

just needed to escape

line='%s'’
