[colug-432] Automatically Edit Configuration File

Rick Hornsby richardjhornsby at gmail.com
Thu Nov 19 09:56:00 EST 2015

> On Nov 19, 2015, at 08:09, Jim Wildman <jim at rossberry.com> wrote:
> You don't mention which distro you are using, but does it support /etc/httpd/conf.d structure?  If so, just drop your stanza
> into an independent file.  Files in conf.d will supercede anything in httpd.conf

One other thought - If you must change a specific line in a file and can't (for whatever reason) manage the whole file, you may look into having Ansible leverage Augeas.  I still suggest when possible managing the whole file, or as Jim says, try to use conf.d files - but Augeas seems like a good tool to have on the proverbial belt.

Augeas knows about many, many *nix configuration file formats and lets you treat the file as a tree, regardless of the file's underlying format (apache conf, yaml, /etc/passwd, etc).  I found Augeas a few weeks ago, and am using it in a very specific use case in Puppet where I need to append usernames to entries in /etc/group.  This is significantly safer than trying to write complex regex match and replace rules.



More information about the colug-432 mailing list