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

Am Dienstag, 24. Februar 2015 21:06:18 UTC+1 schrieb Doug Eubanks:
>
> 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e2c04725-d5d0-4806-b36e-4fd1f9cefb4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to