Automatic Import of Classes

Just doing some planning…

I'm going to be placing our Puppet classes under source control and placed
in a CI environment. With that, as soon as a CI build passes I wish to make
those classes/modules available to Foreman "automatically" as soon as they
are the in appropriate modules directory on the Puppet master.

I am aware of the puppet:import:puppet_classes rake task.

Is there anything wrong with running that task a polling loop or as trigged
from the post-sucess / install stages of the CI system? Is there a better
alternate method?

Foreman will still keep the same parameters and methods applied to a
specific host, correct?

Anything I need to be concerned about in regards to running the rake task
for multiple environments?

Thanks,
-Chris

Chris McCluskey <mcclusk@gmail.com> writes:
> I am aware of the puppet:import:puppet_classes rake task.
>
> Is there anything wrong with running that task a polling loop or as
> trigged from the post-sucess / install stages of the CI system? Is
> there a better alternate method?

None that i am aware of. We are just doing this in our deployment. The
last step of the deployment is to call puppet:import:puppet_classes via
ssh from our CI server (jenkins).

> Foreman will still keep the same parameters and methods applied to a
> specific host, correct?

Yes, thats correct.

> Anything I need to be concerned about in regards to running the rake
> task for multiple environments?

Foreman versions < 1.6 do not support directory environments, so if you
are running puppet >= 3.6 and are using directory environments you
should revert the settings in puppet.conf to the old dynamic
environments.

hth,
toni

··· -- Don't forget, there is no security | toni at stderr dot at -- Wulfgar | Toni Schmidbauer

Chris McCluskey <mcclusk@gmail.com> writes:
> I am aware of the puppet:import:puppet_classes rake task.
>
> Is there anything wrong with running that task a polling loop or as
> trigged from the post-sucess / install stages of the CI system? Is
> there a better alternate method?

None that i am aware of. We are just doing this in our deployment. The
last step of the deployment is to call puppet:import:puppet_classes via
ssh from our CI server (jenkins).

> Foreman will still keep the same parameters and methods applied to a
> specific host, correct?

Yes, thats correct.

> Anything I need to be concerned about in regards to running the rake
> task for multiple environments?

Foreman versions < 1.6 do not support directory environments, so if you
are running puppet >= 3.6 and are using directory environments you
should revert the settings in puppet.conf to the old dynamic
environments.

hth,
toni

··· -- Don't forget, there is no security | toni at stderr dot at -- Wulfgar | Toni Schmidbauer

Thanks Toni and Dominic. Good info.

Somehow I missed the API call. :slight_smile:

-Chris

··· On Friday, September 12, 2014 9:48:49 AM UTC-7, Chris McCluskey wrote: > > Just doing some planning... > > I'm going to be placing our Puppet classes under source control and placed > in a CI environment. With that, as soon as a CI build passes I wish to make > those classes/modules available to Foreman "automatically" as soon as they > are the in appropriate modules directory on the Puppet master. > > I am aware of the puppet:import:puppet_classes rake task. > > Is there anything wrong with running that task a polling loop or as > trigged from the post-sucess / install stages of the CI system? Is there a > better alternate method? > > Foreman will still keep the same parameters and methods applied to a > specific host, correct? > > Anything I need to be concerned about in regards to running the rake task > for multiple environments? > > Thanks, > -Chris > >

> Chris McCluskey <mcclusk@gmail.com> writes:
>> I am aware of the puppet:import:puppet_classes rake task.
>>
>> Is there anything wrong with running that task a polling loop or as
>> trigged from the post-sucess / install stages of the CI system? Is
>> there a better alternate method?
>
> None that i am aware of. We are just doing this in our deployment. The
> last step of the deployment is to call puppet:import:puppet_classes via
> ssh from our CI server (jenkins).

Use "foreman-rake puppet:import:puppet_classes[batch]" to skip
interactive questions. You can also pass envname I think.

>> Foreman will still keep the same parameters and methods applied to a
>> specific host, correct?
>
> Yes, thats correct.

Indeed. There's also an API call available nowadays:

http://theforeman.org/api/apidoc/v2/environments/import_puppetclasses.html

e.g. curl -k -u admin:changeme
https://foreman.example.com/api/v2/smart_proxes/puppet.example.com/import_puppetclasses

or using "hammer proxy import-classes …"

>> Anything I need to be concerned about in regards to running the rake
>> task for multiple environments?

I'd be very careful to ensure you don't run the import if the deploy has
gone wrong. If an environment is removed or not populated correctly
on-disk, importing automatically will simply wipe the data from the
Foreman DB.

> Foreman versions < 1.6 do not support directory environments, so if you
> are running puppet >= 3.6 and are using directory environments you
> should revert the settings in puppet.conf to the old dynamic
> environments.

The 1.5.2 smart proxy also has the directory environments feature
backported too now, as it's proving popular.

··· On 15/09/14 06:57, Toni Schmidbauer wrote:


Dominic Cleal
Red Hat Engineering