# Interface preference for adding text at start/end of a config-file line?

**URL:** <https://forum.ansible.com/t/interface-preference-for-adding-text-at-start-end-of-a-config-file-line/12452>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [March 4, 2013, 6:42pm UTC](https://forum.ansible.com/t/interface-preference-for-adding-text-at-start-end-of-a-config-file-line/12452 "2013-03-04T18:42:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yves\_Dorfsman](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@Yves\_Dorfsman](https://forum.ansible.com/u/Yves_Dorfsman)\
**Post date:** [March 4, 2013, 6:42pm UTC](https://forum.ansible.com/t/interface-preference-for-adding-text-at-start-end-of-a-config-file-line/12452/1 "2013-03-04T18:42:42Z")

</div>

How many different processes will modify your file?  
Would templates work for you?

What about this:

&nbsp;&nbsp;&nbsp;- name: grab value of line DirctoryIndex  
&nbsp;&nbsp;&nbsp;&nbsp;shell: grep 'DirectoryIndex.\*index.php' /etc/httpd/httpd.conf  
&nbsp;&nbsp;&nbsp;&nbsp;register: DIline

&nbsp;&nbsp;&nbsp;- name: comment out DirectoryIndex  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lineinfile: dest=/etc/httpd/httpd.conf regex='DirectoryIndex' line="# $DIline.stdout"
