lineinfile inserts dos style new line character

51 views
Skip to first unread message

jepper

unread,
Jun 16, 2014, 8:12:21 AM6/16/14
to ansible...@googlegroups.com
I'm setting up tomcat, and change a parameter in a config file as follows:

- name: set max-request-size

  lineinfile: dest={{ tomcat_home }}/webapps/manager/WEB-INF/web.xml regexp="max-request-size" line="<max-request-size>1000000000</max-request-size>"

Post processing, lines in the target file web.xml now end with a ^M. The lines that were replaced are fine, e.g.

    <multipart-config>^M
        <max-request-size>1000000000</max-request-size>            <--- OK!
      <file-size-threshold>0</file-size-threshold>^M

This is as seen vi, on a RHEL64 system.

What am I doing wrong?

James Cammarata

unread,
Jun 16, 2014, 12:02:12 PM6/16/14
to ansible...@googlegroups.com
The lineinfile module uses the os.linesep variable to insert newlines, so this should not be happening unless the file had either been edited on a Windows system or had the ^M's before the edit occurred. Can you verify the original file did not have the incorrect newlines, and that you are not running the playbook from a Windows machine (ie. via cygwin)?


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e9cd90ac-d0a5-403f-ba0b-744a37d058ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages