1

I'm playing with etckeeper and it seems to be a good product. I use it only to track /etc filesystem locally, but these days the idea came to my mind - to create central Gitlab repository and to store all the node /etc repositories there.

The question is how can I do that?

I noticed in the config of etckeeper, there is a variable called: PUSH_REMOTE="", but do I have to create separate repository for every server or I can use one and combine all the servers in it? Maybe I can use branches? Or different folders?

Any advice's are welcomed. I will try to do it in manual way, and if it works I will think how to do it in automated way, via Puppet or Ansible..

Thanks in advance.

1 Answers1

1

I think I found a solution. As I mentioned branches earlier, I found that, this is the easiest way to achieve what I want.

So what I've done in few simple steps:

  1. I have created SSH RSA key pairs, to be able to communicate with the Gitlab instance.
  2. I installed etckeeper and git packages to the system. (For Ubuntu/Debian systems the local repository is automatically created) for RedHat systems I have to use etckeeper init in /etc directory to create the repo.
  3. In /etc/etckeeper/etckeeper.conf I added "origin" as PUSH_REMOTE="origin" variable.
  4. When the repo is done (this can be checked with git status) I created local branch called the FQDN name of the machine, and switched to it using git checkout -b test.home.lan
  5. Then I added the remote repository to the local git client with git remote add <gitlab_url>
  6. Finally I used git push --set-upstream origin test.home.lan, to establish sync connection between my local branch and the remote one.

Using this approach every node have its own branch.

I hope this will help somebody.