Automatic Config Templator


#1

This seems like a common problem that I’m pretty sure someone would have solved
already.

Usually a service has a random config file which has something like:
somevar somevalue
or
somevar=somevalue

and i’d be nice to automatically go from that to this:

attributes/default.rb:
default[‘someservice’][‘someconfig’][‘somevar’]=”somevalue”

template/default/someconfig.erb
somevar=<%= @node[‘someservice’][‘someconfig’][‘somevar’] %>

Then you just need to define various patterns to identify configs like:
A:B
A=B
A B

And could even do something like
#automatic commentary
A=B

Anyone know if this already exists?


#2

Too good not to share:

http://devopsreactions.tumblr.com/post/81376369612/non-standardized-environment (SFW)

Interested in hearing other possible titles for this one… :slight_smile:

-Ross


#3

Hi,

I try to create something like this with my cookbook “conffile”:
http://community.opscode.com/cookbooks/conffile

The goal is to create a configuration file from an Hash.

My documentation is quite… poor… because I changed my mind so many many
time…

For the moment I can only manipulating “INI” type file for the moment (like
you seems to want).

You can find some examples in my “test” recipe:

Even if “ini” type file are really old… manipulating this with ruby is
really a mess!
Many different lib, none of them perfect.

I will be really happy if you are helping me to improve this. :slight_smile:

Guilhem Lettron

On Tue, Apr 8, 2014 at 12:59 AM, dchalloner@gmail.com wrote:

This seems like a common problem that I’m pretty sure someone would have
solved
already.

Usually a service has a random config file which has something like:
somevar somevalue
or
somevar=somevalue

and i’d be nice to automatically go from that to this:

attributes/default.rb:
default[‘someservice’][‘someconfig’][‘somevar’]=“somevalue”

template/default/someconfig.erb
somevar=<%= @node[‘someservice’][‘someconfig’][‘somevar’] %>

Then you just need to define various patterns to identify configs like:
A:B
A=B
A B

And could even do something like
#automatic commentary
A=B

Anyone know if this already exists?