# replacing mutliple files using lineinfile

**URL:** <https://forum.ansible.com/t/replacing-mutliple-files-using-lineinfile/13955>\
**Category:** Ansible Project\
**Created:** [November 21, 2013, 2:00pm UTC](https://forum.ansible.com/t/replacing-mutliple-files-using-lineinfile/13955 "2013-11-21T14:00:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![n0vember](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@n0vember](https://forum.ansible.com/u/n0vember)\
**Post date:** [November 21, 2013, 2:00pm UTC](https://forum.ansible.com/t/replacing-mutliple-files-using-lineinfile/13955/1 "2013-11-21T14:00:39Z")

</div>

Hi all,

I’m trying to make modifications in tomcat config file server.xml using lineinfile. I have a whole valve tag to comment. I have things like that :

And whould like to insert after.

Problème is that the tag may be on multiple lines :

How to match this, and replace it ? Maybe lineinfile is not the solution…

Regards

n0vember

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [November 21, 2013, 7:59pm UTC](https://forum.ansible.com/t/replacing-mutliple-files-using-lineinfile/13955/2 "2013-11-21T19:59:21Z")

</div>

I use the template module to create our tomcat server.xml files. This is probably a bit of overkill for the lineinfile module.
