Foreman Provision Templates Enhancement

Hi,

I have an idea to improve(?) the provision templates delivered with
Foreman.

Over time, I've struggled to merge/rebase updates that are put into the
core templates into the "clones" that I have implemented for our system
profiles. Would it be possible to add a method (snippet or array
parameter) to allow for setting additional packages/package groups to be
installed at provision time? This would hit 95% of the reason we clone
provision templates to fulfill provisioning of systems with different
profiles…and allow end-users like me the ease of not having to rebase
template clones after every template update.

We use provision templates for both servers and desktops, the desktops
deliver over 1300 packages during provisioning, and I'm loathe to try and
manage that much directly with Puppet post install.

If this is off topic, should I just take this over to the
community-templates repo on github for further discussion?

Thanks!

I think it would be very interesting to have this extended to eh
hostgroup form.
– b
k

··· On 09/29/2017 11:23 AM, Sean A wrote: > Hi, > > I have an idea to improve(?) the provision templates delivered with > Foreman. > > Over time, I've struggled to merge/rebase updates that are put into the > core templates into the "clones" that I have implemented for our system > profiles. Would it be possible to add a method (snippet or array > parameter) to allow for setting additional packages/package groups to be > installed at provision time? This would hit 95% of the reason we clone > provision templates to fulfill provisioning of systems with different > profiles...and allow end-users like me the ease of not having to rebase > template clones after every template update. > > We use provision templates for both servers and desktops, the desktops > deliver over 1300 packages during provisioning, and I'm loathe to try > and manage that much directly with Puppet post install. > > If this is off topic, should I just take this over to the > community-templates repo on github for further discussion? >

> Hi,
>
> I have an idea to improve(?) the provision templates delivered with
> Foreman.

Excellent :slight_smile:

> Over time, I've struggled to merge/rebase updates that are put into
> the core templates into the "clones" that I have implemented for our
> system profiles.

Whilst I'll address your suggestion below… as an aside, have you
looked at the foreman_teplmates plugin? That allows you to manage your
own templates in Git, which also means you can rebase your changes on
top of ours on a regular basis. Just some food for thought :slight_smile:

> Would it be possible to add a method (snippet or array parameter)
> to allow for setting additional packages/package groups to be
> installed at provision time? This would hit 95% of the reason we
> clone provision templates to fulfill provisioning of systems with
> different profiles…and allow end-users like me the ease of not
> having to rebase template clones after every template update.
>
> We use provision templates for both servers and desktops, the
> desktops deliver over 1300 packages during provisioning, and I'm
> loathe to try and manage that much directly with Puppet post install.

I think this is a fair suggestion. It's really pretty easy to add a
parameter to a template which defaults to "[]" and is expanded as a
list of additional packages to install. Calling it
"additional_packages" seems fair :slight_smile:

The only snag is that Arrays can only be used in class parameters at
the moment - host/hostgroup/domain/etc params are still simple strings
(work has been in progress on that for a bit). So, in the short term at
least, it would probably have to be a comma-separated string list that
can be split up in the template. I'm not sure if we have a character
limit of string params, so doing 1300 packages this way might be
awkward, but otherwise it should work OK. Obviously, once we can use
complex params here, a YAML list is probably the most convenient.

Doing it as a snippet is also possible, but much harder to override at
the hostgroup/domain/etc level than a parameter (as Bryan suggests) -
since you can only have one snippet by the name referenced in the main
provision template, you're really only moving the problem.

> If this is off topic, should I just take this over to the community-
> templates repo on github for further discussion?

It's not off-topic at all - it never hurts to check that our thinking
is in agreement :). That said, the community templates repo is
definitely the place to raise it - and do feel free to send a patch, if
you're in the mood! More contributors are always welcome.

Cheers
Greg

··· On Fri, 2017-09-29 at 08:23 -0700, Sean A wrote: