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 ; 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
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.
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.