# Announcing: lineinfile module

**URL:** <https://forum.ansible.com/t/announcing-lineinfile-module/11564>\
**Category:** Ansible Project\
**Created:** [May 20, 2012, 4:59pm UTC](https://forum.ansible.com/t/announcing-lineinfile-module/11564 "2012-05-20T16:59:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Art\_Zemon](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Art\_Zemon](https://forum.ansible.com/u/Art_Zemon)\
**Post date:** [May 20, 2012, 4:59pm UTC](https://forum.ansible.com/t/announcing-lineinfile-module/11564/1 "2012-05-20T16:59:57Z")

</div>

Folks,

I have written my **lineinfile** module which allows you to administer individual lines within files, using the same semantics that ansible currently uses to administer individual files within the filesystem.

You can get the file from [https://github.com/azemon/ansible](https://github.com/azemon/ansible) ; either grab file library/lineinfile from the lineinfile branch or download the lineinfile-v1.0 tag.

Here is the documentation from the top of the file:

# lineinfile module - assures that a line exists in a file

---

<div class="post-metadata">

**Author:** ![Pas](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@Pas](https://forum.ansible.com/u/Pas)\
**Post date:** [May 21, 2012, 1:52pm UTC](https://forum.ansible.com/t/announcing-lineinfile-module/11564/2 "2012-05-21T13:52:31Z")

</div>

Hi!

Nice module, really handy for config files where templates are not really an option. However, I had to edit line 172, and use (k, v) = x.split(“=”, 1), because if the “value” contained equal signs (as SSH public keys usually do) it died rather annoyingly.

Thanks,  
Pas

---

<div class="post-metadata">

**Author:** ![Art\_Zemon](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Art\_Zemon](https://forum.ansible.com/u/Art_Zemon)\
**Post date:** [May 22, 2012, 11:50am UTC](https://forum.ansible.com/t/announcing-lineinfile-module/11564/3 "2012-05-22T11:50:11Z")

</div>

Thanks, Pas. I will update my copy of the module and push it to github later today.

– Art Z.

---

<div class="post-metadata">

**Author:** ![Brad\_Olson](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@Brad\_Olson](https://forum.ansible.com/u/Brad_Olson)\
**Post date:** [May 25, 2012, 9:33pm UTC](https://forum.ansible.com/t/announcing-lineinfile-module/11564/4 "2012-05-25T21:33:02Z")

</div>

Hey Art, I'd like to have your module in the new ansible-contrib repo.  
Are you willing?

Michael's proposing contriibuted modules have a subdirectory each.  
That approach would have me asking you to make a separate github  
project with this structure

lineinfile\_artzemon/

> -README.md - description, usage, prerequisites, contact info

`-lineinfile - the module

That would let me the contribs repo follow your changes, but it it  
sounds like too much work, let's talk about another route. I'm open to  
ideas.

Thanks again for writing it!  
--Brad

---

<div class="post-metadata">

**Author:** ![Art\_Zemon](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Art\_Zemon](https://forum.ansible.com/u/Art_Zemon)\
**Post date:** [June 2, 2012, 5:07pm UTC](https://forum.ansible.com/t/announcing-lineinfile-module/11564/5 "2012-06-02T17:07:40Z")

</div>

Brad,

I am very willing but it will be awhile until I can get the github repo set up. Very busy right now.

– Art Z.

---

<div class="post-metadata">

**Author:** ![Art\_Zemon](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Art\_Zemon](https://forum.ansible.com/u/Art_Zemon)\
**Post date:** [June 21, 2012, 12:20pm UTC](https://forum.ansible.com/t/announcing-lineinfile-module/11564/6 "2012-06-21T12:20:52Z")

</div>

Thanks for reminding me to push the patched version to github.

– Art Z.
