Make additional repositories available during kickstart (RH operating systems)

Problem:
Is there a way to make additional repositories available during the basic kickstart of RH[EL] type operating systems?

Expected outcome:
Multiple repositories available to use when installing the %packages section of the kickstart file, in addition to the base operating system.

Foreman and Proxy versions:
foreman-1.23.0-1.el7.noarch
foreman-proxy-1.23.0-1.el7.noarch

katello-3.13.0-1.el7.noarch

Other relevant data:

This is a collapsed install, all services running on a single host (CentOS7,) fully patched.

Looking at the Kickstart default provisioning template, it looks like there’s a array of hashes called additional_media that would suit my needs. I haven’t been able to figure how (due to my very obvious lack of knowledge,) to populate this array/value. I can tell that the template is getting rendered around those lines, but I don’t get anything in the resulting kickstart file.

Help? Tips?

Hey, this special macro is used internally by Foreman/Katello, the array is not exposed to users. What you can do however is to clone the template and then add new lines with them using regular kickstart syntax.

Darn it, I was afraid you were going to say something like that.

Something that I’m really trying hard to avoid is having to spin through templates after an upgrade to potentially reclone and reapply mods. Hrrrm… THERE’S an idea… I may be able to script that, with hammer calls and/or REST API calls. This is something I can do manually at the start, long term, it will require automation.

And per our IRC discussion, I’ll file a PR with a suggestion to add a repository hook in the default templates. That will render my musings above moot.

Yeah we have some of these and we need more. This makes extending templates without cloning them a breeze!

provisioning_templates/provision/kickstart_default.erb
160:<%= snippet_if_exists(template_name + " custom packages") %>
185:<%= snippet_if_exists(template_name + " custom pre") %>
208:<%= snippet_if_exists(template_name + " custom post") %>

provisioning_templates/PXELinux/preseed_default_pxelinux.erb
42:<%= snippet_if_exists(template_name + " custom menu") %>

provisioning_templates/PXELinux/kickstart_default_pxelinux.erb
99:<%= snippet_if_exists(template_name + " custom menu") %>

provisioning_templates/PXEGrub/kickstart_default_pxegrub.erb
74:<%= snippet_if_exists(template_name + " custom menu") %>

provisioning_templates/finish/preseed_default_finish.erb
34:<%= snippet_if_exists(template_name + " custom snippet") %>

provisioning_templates/PXEGrub2/preseed_default_pxegrub2.erb
55:<%= snippet_if_exists(template_name + " custom menu") %>

provisioning_templates/PXEGrub2/kickstart_default_pxegrub2.erb
99:<%= snippet_if_exists(template_name + " custom menu") %>

Awaiting your PR!

Unquestionably, Lukáš.

Whoever dreamed up the if exists methodology deserves a gold star. For that matter, even if you weren’t so open to adding more, it’d still be the way to go as it’s a lot less intensive to refit after a default template upgrade.

Filling out the PR is the task for this afternoon, I got tied up on a completely unrelated problem in the office.

1 Like

Good morning, Lukáš.

No, I haven’t forgot. I’ve been offline for the last week+ decompressing. Now it’s back to the grindstone.

1 Like