Ask Your Question
0

r10k Control Repos : deploy the enviroment automaticaly from main git to control repo

asked 2017-05-18 08:52:19 -0500

hello everyone . I do not wish to reinvent the wheel. Do you know if there's something for a script that will automatically allow me to add the branch created from git to the repo control with the Puppetfile ?

At the end , a script trigger and deploy the enviroment automaticaly ?

Thank you so much , -t

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-05-19 23:17:45 -0500

minimike gravatar image

Like DaryIW said r10k is your best choise

If you use an git-repo on the same box like the puppetmaster... post-receive

Or you use Jenkins or Rundeck. But aware Jenkinsfile hasn't support for bashscripts directly. You have to choose Groovy or manage your jobs manually.

Since I'm switched to gitlab, I've installed gitlab-runner on all my puppetmasters.

job:
  script:
    - sudo /usr/local/bin/r10k deploy -c /usr/local/etc/puppet/r10k/r10k.yaml environment $ENV --color
edit flag offensive delete link more
0

answered 2017-05-19 21:37:23 -0500

DarylW gravatar image

That is exactly how it should work by default.
https://docs.puppet.com/pe/latest/r10...

Initial r10k run
The first time you run r10k, deploy all environments and modules.

On the command line, run:
`r10k deploy environment`
This command:

1. Checks your control repository to see what branches are present.
2. Maps those branches to the Puppet directory environments.
3. Clones your Git repo, and either creates (if this is your first run) or updates (if it is a subsequent run) your directory environments with the contents of your repo branches.

So, when you run the command r10k deploy environmentit will deploy an environment for each branch in your control repo. You could either run this on a cron, or trigger it with an external 'webhook', as documented by this post from rnelson0 - https://rnelson0.com/2015/05/03/confi... but you can use the r10k module to set up and configure r10k on your puppet master - http://forge.puppet.com/puppet/r10k. There are examples for authenticated and unauthenticated webooks in the readme

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-05-18 08:52:19 -0500

Seen: 36 times

Last updated: May 19