digressions from meandering

git for configuration files tracking 26-Oct-2012 09:13 PM

There are some things that are awfully out of fashion, that I still do. One of those things is maintaining server with its own configuration — personality, if you please. As opposed to maintaining the army of 125000 identical machines (yes, right, the same goes for humans).

That definitely doesn't take any enterprise grade configuration management system unless done in corporate environment, due to the lack of managers to keep confused. For tracking configuration files one can get away with widely available tools while nobody sees. In particular, I like putting files in git repository.

So I thought I'd put some snippets here for future reference and copy pasting.

First thing is add a nice alias for the root user (that guy who is in charge of breaking configuration):

alias cfgit='git --git-dir=/var/cfgit --work-tree=/'

Or even

eval $(echo "alias cfgit='git --git-dir=/var/cfgit --work-tree=/'" | tee -a /root/.bash_aliases)

(depending on the distribution). Then initialize and configure the /var/cfgit repository:

git init --bare --shared=0600 /var/cfgit
cfgit config core.logallrefupdates true
cfgit config user.name root@$(hostname)
cfgit config user.email root@klever.net
echo /\* >/var/cfgit/info/exclude

Done. Now one can add files to track before breaking the system.

cfgit add -f /etc/tobebroken/
cfgit commit -m 'stock tobebroken package configs'
cfgit add -f /usr/local/bin/mygreatscript
cfgit commit -m 'my great script before I broke it'

and so forth…

This page is a work of fiction and is intended to be viewed for depression purpose only. All characters and incidents mentioned or not are fictional, any resemblance to the actual companies, incidents, or persons living or dead is unintended and purely coincidental. Note: This disclaimer is also fictitious.
Michael Krelin
Munich, Germany
born on the 28th of February