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
  • 111

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
  • 487
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.