I have just setup Foreman for the first time & am not sure how to go about putting all of my configurations under version control. I know I can use Git for each module I install on my Puppet master but would prefer a more holistic solution that encompasses not just modules but also what classes are associated with each host and any variables set on the hosts. Any suggestions would be greatly appreciated along with related workflows. In case it's relevant, I do have GitLab setup as a central Git server on site and plan to setup a CI server such as Jenkins soon.

  • did you find what you're looking for? I'm still searching for a wholistic approach to managing Foreman templates and conf. mgmt. I noticed this question has zero accepted answers. – harperville Oct 24 '18 at 17:57

There is a plugin to keep your infrastructure definition in Foreman, pretty much a serialized version of your data in Git, and upload (and change your infrastructure) changes. Maybe that'd be useful for you


  • At first glance, this may be exactly what I have been looking for! I'll check it out more soon and accept as the answer if it is. Thanks! – GeneBean Oct 29 '14 at 17:45

With foreman you should be able to view all classes along with any configuration variable assigned in the host details. See: http://theforeman.org/manuals/1.4/index.html.

  • But how do I apply version control to all of that info? – GeneBean Apr 19 '14 at 22:02

I am not sure if i understand your question but did you came across "puppet librarian" https://github.com/rodjek/librarian-puppet? There you are able to define which versions/sha1 of puppet modules you like to use.

  • Very helpful information (and something I will most likely put to use) but not what I am looking for. I am looking to apply version to all the things done in Foreman and Puppet, not just the modules. Does that clear up what I am trying to do any? – GeneBean Apr 21 '14 at 19:52

Just in case someone is reading this later: With puppet you are able to define which version of package/software you would like to install with the "version => X.Y.Z" declaration.

Gene, i tried my best but i still dont get your question. Sorry for that :(

  • No problem, I really appreciate the attempt. – GeneBean Apr 22 '14 at 0:25

I think what you are after is very simple.

The Puppet configs are in /etc/puppet. The most simple option is just to run

git init /etc/puppet/

you can then add Gitlab as a remote and push to it.

Alternatively, you could try something like what I describe here which is not Foreman-centric, but I see no reason why you could not use it as inspiration.


You might also consider etckeeper, which does it automatically

You even could write a wrapper like

vi puppet_wrapper.sh

# variables
ETCKEEPER=`which etckeeper`
PUPPET=`which puppet`

# Msg would be your commit msg
etckeeper commit $ETCKEEPER_MSG

# PUPPET_CMD e.g. apply
puppet $PUPPET_CMD

i'm working with this for awhile and its okay for my needs.


I think you just need to setup a repository in git where each branch of the git repo will map to a puppet environment and when you want to change something in puppet , just clone the repo , make changes , and push it to the corresponding branch. You also need to setup a git hook that will fire when you push your changes to the git repo so that it updates the mapped environment on puppet server. You can do all this either manually or just through this puppet module.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.