# how to comment out or remove the characters (\<!-- --\>) in the tomcat web.xml file using ansible and also a simple playbbok to add the tomcat filters to web.xml file

**URL:** <https://forum.ansible.com/t/how-to-comment-out-or-remove-the-characters-in-the-tomcat-web-xml-file-using-ansible-and-also-a-simple-playbbok-to-add-the-tomcat-filters-to-web-xml-file/26306>\
**Category:** Ansible Project\
**Created:** [December 15, 2017, 7:07pm UTC](https://forum.ansible.com/t/how-to-comment-out-or-remove-the-characters-in-the-tomcat-web-xml-file-using-ansible-and-also-a-simple-playbbok-to-add-the-tomcat-filters-to-web-xml-file/26306 "2017-12-15T19:07:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Veeresh\_Reddy](https://avatars.discourse-cdn.com/v4/letter/v/e9c0ed/32.png) [@Veeresh\_Reddy](https://forum.ansible.com/u/Veeresh_Reddy)\
**Post date:** [December 15, 2017, 7:07pm UTC](https://forum.ansible.com/t/how-to-comment-out-or-remove-the-characters-in-the-tomcat-web-xml-file-using-ansible-and-also-a-simple-playbbok-to-add-the-tomcat-filters-to-web-xml-file/26306/1 "2017-12-15T19:07:41Z")

</div>

how to comment out or remove the characters () in the tomcat web.xml file using ansible and also a simple playbbok to add the tomcat filters to web.xml file.please help me

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 19, 2017, 12:44pm UTC](https://forum.ansible.com/t/how-to-comment-out-or-remove-the-characters-in-the-tomcat-web-xml-file-using-ansible-and-also-a-simple-playbbok-to-add-the-tomcat-filters-to-web-xml-file/26306/2 "2017-12-19T12:44:00Z")

</div>

You could use a regex to strip comments, but that's going to be fragile at best.  
Might be better off by processing it with a real XML parser.  
Take a look at the new xml module:  
[http://docs.ansible.com/ansible/latest/xml\_module.html](http://docs.ansible.com/ansible/latest/xml_module.html)  
You might be able to use that to add your tomcat filters.

Dick
