Commenting out lines

1,902 views
Skip to first unread message

Christoph Haas

unread,
Mar 6, 2014, 12:44:51 PM3/6/14
to ansible...@googlegroups.com
Dear list,

what do you consider best practice when you want to comment out (or in)
a certain line in a configuration file? The "lineinfile" module does not
seem flexible enough for my taste.

Example: I want to change my etckeeper.conf from

# The VCS to use.
#VCS="hg"
#VCS="git"
VCS="bzr"
#VCS="darcs"

to

# The VCS to use.
#VCS="hg"
VCS="git"
#VCS="bzr"
#VCS="darcs"

In this example I could probably do it by specifying the entire line.
But what I'm looking for is something like:

- comment out all lines like ^VCS
- comment in the line like ^#VCS.*git

But in other cases I wouldn't know how the line exactly looks. I would
prefer to look for a pattern and enable that.

Puppet has Augeas support for that purpose. What would you recommend?

Kindly
…Christoph

Serge van Ginderachter

unread,
Mar 6, 2014, 1:26:11 PM3/6/14
to ansible...@googlegroups.com
lineinfile can be fine for small use cases, but often, the better is to template the whole file.





…Christoph

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5318B413.9040805%40christoph-haas.de.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages