I have a bunch of *nix servers in production. I would like to put it's important configuration files in version control
The basic idea I had was to
Put a distributted version control system so that each system's configurations are saved on its own drive.
The way configurations are changed are either through an editor or through an external source.
Assuming that $EDITOR is used in shell, it would be possible to add an extra command upon saving the file (so the file is then added to git). This could be problematic as it is not always that a user would do vim /etc/my.cnf , it could be opening my.cnf from within vim
The other source of change can be captured via a cron script, which runs say every one hour and adds stuff to version control (this is good enough). Then the git repo can be pulled into a central place for safekeeping. 1 hour is good enough as it is assumed that first way of capturing changes will work most of the time.
I would like to know that if there is some tool which already does this (or does it better). It would be ideal that on each configuration change initiated by a user, s/he is propted to add the change into the local repo.
I did something similar to this. However we would manage configuration files in Puppet which would then be stored in SVN. I have two other linux admins on a server farm of 160 servers and this worked well. It provided change history (SVN) as well as configuration management via Puppet.
Take a look at etckeeper - it's pretty close to what you're looking for.
look into tools such as puppet or cfengine. Its usually a better outcome, imho.