I need to import provisioning templates and snippets copied into place by puppet when provisioning new foreman servers.
Import templates using hammer and find them in the web ui after I’m done with hammer.
Foreman and Proxy versions:
Foreman and Proxy plugin versions:
Distribution and version:
Redhat 8 server
Hi, with cobbler we were able to just dump files into cobbler kickstarts and they would appear in the web front end. At first I thought this would happen with foreman and could have sworn it worked with one test file with .erb extension after finding where the default foreman provisioning templates were located.
So I had puppet copy a bunch of files over to /usr/share/foreman/app/views/unattended/provisioning_templates/provision as well as snippet. I included the <%# -%> comments which I though somehow picked up the relevant info, but I’m not sure how foreman works. I also set organization and location to anything. Still no dice. Example below.
So do I need to use hammer to import them into the database?
If so is there a way to grab entire directories of snippets and kickstarts at once? I saw an older post that used hammer import-templates --dirname but now it seems that command is deprecated in favour of “hammer template import --file” and it seems like I’d have to do one file at a time? Am I missing something. Is there a --dirname option or something similar? I suppose i could set up some sort of ruby do each thing in puppet to cycle through a large list of our snippets and pass names to the hammer command in a loop, but grabbing them all at once with one command from a directory would be a lot easier.
Sorry if this is unclear. I’ll follow up if clarification is needed. With puppet I can subscribe to the folder and if it detects a change it can notify an exec that runs the hammer import command.
Other relevant data:
Example header in snippet file
Set role to render in puppet facts.