lineinfile can be fine for small use cases, but often, the better is to
template the whole file.




On 6 March 2014 18:44, Christoph Haas <[email protected]> wrote:

> 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
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEhzMJB3EY%3D0dGpOSnfkLBt%2Bm9o4f6PzSLkspFsM9CVXbn0daQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to