# Strange backslash quote issue

**URL:** <https://forum.ansible.com/t/strange-backslash-quote-issue/17612>\
**Category:** Ansible Project\
**Created:** [February 24, 2015, 8:06pm UTC](https://forum.ansible.com/t/strange-backslash-quote-issue/17612 "2015-02-24T20:06:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doug\_Eubanks](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Doug\_Eubanks](https://forum.ansible.com/u/Doug_Eubanks)\
**Post date:** [February 24, 2015, 8:06pm UTC](https://forum.ansible.com/t/strange-backslash-quote-issue/17612/1 "2015-02-24T20:06:18Z")

</div>

Hello:

This:

- name: reconfigure suexec path in httpd spec  
lineinfile: dest=/root/rpmbuild/SPECS/httpd.spec regexp=‘^._–with-suexec-docroot=._’ line=’ --with-suexec-docroot=/home ' insertafter=‘^._–with-suexec-caller=._’  
when: suexec\_output|changed

Is throwing this error:

ERROR: There was an error while parsing the task “lineinfile dest=/root/rpmbuild/SPECS/httpd.spec regexp=‘^._–with-suexec-docroot=._’ line=’ --with-suexec-docroot=/home \’ insertafter=‘^._–with-suexec-caller=._’”.  
Make sure quotes are matched or escaped properly

I’ve tried escaping the backslash, using single quotes, double quotes, and I just can’t find the right combination. I need it to use literal string below, including the backslash.  
–with-suexec-docroot=/home \

Whats the correct syntax for this?

Doug

---

<div class="post-metadata">

**Author:** ![Damian\_Lubosch](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@Damian\_Lubosch](https://forum.ansible.com/u/Damian_Lubosch)\
**Post date:** [June 24, 2015, 3:23pm UTC](https://forum.ansible.com/t/strange-backslash-quote-issue/17612/2 "2015-06-24T15:23:41Z")

</div>

Hi,

I have exactly the same issue.  
In lineinfile module adding backslashes at the end of a line leads to an error:

ERROR: There was an error while parsing the task ‘lineinfile dest=/root/rpmbuild/SPECS/nginx.spec insertafter=“._–with-http\_mp4\_module._” line=' --with-http\_image\_filter\_module \\'’.  
Make sure quotes are matched or escaped properly  
Ansible failed to complete successfully. Any error output should be  
visible above. Please fix these errors and try again.  
FAIL: 1

My provisory solution for this is to add a backslash and space at the end of the to be added line and to remove the additional space with sed:

- name: enable --with-http\_image\_filter\_module  
lineinfile: dest=/root/rpmbuild/SPECS/nginx.spec insertafter=“.\*–with-http\_mp4\_module " line=” --with-http\_image\_filter\_module \ "

- name: fix for trailing backslash  
command: sed -i ‘s/\ /\/g’ /root/rpmbuild/SPECS/nginx.spec

Anyway, using

line=“blablabla \”

should lead to the text  
blablabla \

without any spaces etc. Where can I ask for this to be added?

Cheers,  
Damian
