8

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.

GeneBean
  • 313
  • 1
  • 4
  • 10
  • 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

7 Answers7

2

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

https://github.com/marianitadn/foregit

eLobato
  • 281
  • 1
  • 5
  • 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
0

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.

0

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
0

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 :(

0

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.

chriscowley
  • 523
  • 4
  • 17
0

You might also consider etckeeper, which does it automatically

You even could write a wrapper like

vi puppet_wrapper.sh

#!/bin/bash
# variables
ETCKEEPER=`which etckeeper`
ETCKEEPER_MSG=$1
PUPPET=`which puppet`
PUPPET_CMD=$2

# 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.

risker
  • 31
  • 5
0

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.

https://github.com/theforeman/puppet-puppet

Ijaz Ahmad
  • 250
  • 1
  • 8