# can't get embedded quotes to work in replace string of lineinfile

**URL:** <https://forum.ansible.com/t/cant-get-embedded-quotes-to-work-in-replace-string-of-lineinfile/21944>\
**Category:** Ansible Project\
**Tags:** fedora\
**Created:** [July 7, 2016, 6:49am UTC](https://forum.ansible.com/t/cant-get-embedded-quotes-to-work-in-replace-string-of-lineinfile/21944 "2016-07-07T06:49:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo\_P](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@Leo\_P](https://forum.ansible.com/u/Leo_P)\
**Post date:** [July 7, 2016, 6:49am UTC](https://forum.ansible.com/t/cant-get-embedded-quotes-to-work-in-replace-string-of-lineinfile/21944/1 "2016-07-07T06:49:18Z")

</div>

I have tried escaping characters but it didn’t seem to make any difference. According to the documentation I’ve seen, this should work:

`

- name: Change keyboard layout to U.S.  
lineinfile: dest=/etc/default/keyboard  
regexp=‘XKBLAYOUT=“gb”’  
replace=‘XKBLAYOUT=“us”’

`

But I get this error:

`  
TASK [Change keyboard layout to U.S.] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [raspberrypi]: FAILED! =\> {“changed”: false, “failed”: true, “msg”: “unsupported parameter for module: replace”}

`

The ansible version is 2.1.0.0 running on fedora 23. What am I doing wrong?

Thanks!

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 7, 2016, 5:46pm UTC](https://forum.ansible.com/t/cant-get-embedded-quotes-to-work-in-replace-string-of-lineinfile/21944/2 "2016-07-07T17:46:20Z")

</div>

Module lineinfile doesn't have replace parameter. I think you are trying to use the replace module.

- name: Change keyboard layout to U.S.  
&nbsp;&nbsp;&nbsp;replace:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dest=/etc/default/keyboard  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;regexp='XKBLAYOUT="gb"'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replace='XKBLAYOUT="us"'
