1

I have recently decided to use a version-control system to share my configuration files between my different linux installs.

After reading another thread I found on this subject, I'm planning to do it using git.

I would put my / under revision control with a top-level .gitignore set to * and add manually each configuration file I want to keep track of (mainly files from /etc/…).

What I don't get though, is how I can handle different home directories. As an example, say on machine A I have /home/foo/.vimrc and on machine B /home/bar/.vimrc, how could I get git to keep both files under the same version control repository?

[Update]

I am looking for a very lightweight solution that does just what I need to (no Puppet or Cfengine for example). I was thinking about creating a .config folder in my /home/whatever/ in which I would keep all my important configuration files using a git repository. A very simple script would then create the needed symbolic links from my /etc/, ~/… and so on. Any other suggestions?

nimser
  • 11
  • 3

2 Answers2

3

Arguably, you're trying to use a revision control system to do configuration management. Those are two very different kinds of activities. I think the approach you're taking won't scale well at all, and will lead to significant amounts of frustration. You would be better served to find decide upon a configuration management solution (there's quite a few well matured options out there: cfengine, puppet, chef, etc), and then have your configuration management solution pull its recipes and/or configuration files from the revision control system. It will give you the same net effect that you seem to be looking for, but will have the right tools working on the appropriate parts of the problem.

ttyS0
  • 469
  • 2
  • 4
  • I think the tools you mentioned are too heavy/complex for my needs : they also provide solutions such as auto-installing some packages or finding inconsistencies in confs files and so on. Moreover, some of them need a server running (if I got that right). I want a very lightweight solution that does just what I need to. I was thinking about creating a `.config` folder in my `/home` where I would put all my important configuration files. A very simple script would then create the needed symbolic links. Any other suggestion? – nimser Apr 08 '11 at 17:24
  • I think the problem is more complex than a simple shell script can accomodate. What happens when a package update changes the files in /etc, or how about when that package update clobbers the symlinks because it moves existing configs to /etc/config.orig and then merges the contents into a new /etc/config file that is now outside the scope of your repository. Having said that, definitely give it a try, but be sure to exercise the system before claiming it a success. :) – ttyS0 Apr 10 '11 at 00:37
0

You could try ansible. It does not need a different server. You could even have the main repository on one or more of your systems and run ansible from each of them. And you could keep all the files in the configuration directories in sync even if the content has to differ (e.g. /etc/hostname, /etc/mailname, ...)

If you really want to use git: What I don't get is why you want to put / as the base path for your git. Why don't you start multiple git-repositories.

  • One of them your be your $HOME . So it doesn't matter what your username is. Maybe you could use the ~/.config dir to symlink the files that are actually expected in ~/ . Then you wouldn't even have to use .gitignore on this repository.

  • The next one would be for /etc exclusively.

user2563336
  • 116
  • 4