Ask Your Question

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

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

tutelacooldouce gravatar image

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


Also, how handle feature branches the right way? How do I test changes? What is the designed approach to deploy them to test systems, maybe even spin up test systems from scratch as virtual machines or so? - Question on Slack: .

bittner gravatar imagebittner ( 2017-08-04 04:54:16 -0600 )edit
bittner gravatar imagebittner ( 2017-08-04 05:33:31 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

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

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.

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

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

DarylW gravatar image

That is exactly how it should work by default.

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 - but you can use the r10k module to set up and configure r10k on your puppet master - 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


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

Seen: 392 times

Last updated: May 19 '17