I'm just wondering is it possible to update Puppet classes in the Foreman
dashboard automatically or every time when you make change you have to go
Configure -> Puppet classes and update automatically?
I keep my puppet classes in a git repo, and use a post-receive hook to
update foreman.
I posted it on pastebin here: http://pastebin.com/Y5zd6qcQ
Everytime you push to the repo with this hook, it will update your
environments to match your repo. Basically, if you create a new branch, it
will clone the branch into /etc/puppet/environments/branch_name and tell
foreman to update its puppet environments. If you update an existing
branch, it will push the updates to the environment and tell foreman to
update. If you delete a branch, it will move any hosts that were on that
branch into production, then delete the branch.
To use this hook, you will need to install python-requests.noarch
and python-requests-oauthlib.noarch. You will also need to set the url of
your foreman server in the script, allow api access, and add your api
key/secret to the script. The script gets placed in your git repo at
.git/hooks/post-receive. If you need help with it, feel free to ask. I
wrote it as a quick script, so it is rough around the edges.
-Mark
···
On Tue, Jan 27, 2015 at 2:28 PM, tyon wrote:
Hi all,
I’m just wondering is it possible to update Puppet classes in the Foreman
dashboard automatically or every time when you make change you have to go
Configure -> Puppet classes and update automatically?
Thank you so much Mark! I will look into it as soon as I'm done with my
current tasks.
···
On Tuesday, January 27, 2015 at 11:47:45 AM UTC-8, Mark Murnane wrote:
>
> I keep my puppet classes in a git repo, and use a post-receive hook to
> update foreman.
> I posted it on pastebin here: http://pastebin.com/Y5zd6qcQ
>
> Everytime you push to the repo with this hook, it will update your
> environments to match your repo. Basically, if you create a new branch, it
> will clone the branch into /etc/puppet/environments/branch_name and tell
> foreman to update its puppet environments. If you update an existing
> branch, it will push the updates to the environment and tell foreman to
> update. If you delete a branch, it will move any hosts that were on that
> branch into production, then delete the branch.
>
> To use this hook, you will need to install python-requests.noarch
> and python-requests-oauthlib.noarch. You will also need to set the url of
> your foreman server in the script, allow api access, and add your api
> key/secret to the script. The script gets placed in your git repo at
> .git/hooks/post-receive. If you need help with it, feel free to ask. I
> wrote it as a quick script, so it is rough around the edges.
> -Mark
>
> On Tue, Jan 27, 2015 at 2:28 PM, tyon <surb...@ucdavis.edu > > wrote:
>
>> Hi all,
>>
>> I'm just wondering is it possible to update Puppet classes in the Foreman
>> dashboard automatically or every time when you make change you have to go
>> Configure -> Puppet classes and update automatically?
>>
>> Maybe somebody has a cron job or something?
>>
>> Puppet-3.7.3
>> Foreman-1.7.1
>>
>> Many thanks in advance!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Foreman users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to foreman-user...@googlegroups.com .
>> To post to this group, send email to forema...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/foreman-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>