Importing Foreman Templates from Git or Local

Hi guys, I am trying to import some windows templates into forman (GitHub - LiamLeane/ForemanWindows: Foreman provisioning scripts for Windows and detailed Windows setup guide).

I installed the foreman cli plugin that enabled the hammer cli. How do I import the Templates?

Tried Locally:

  • Downloaded /tmp/ForemanWindow
  • hammer import-templates --dirname ~/ForemanWindows/ --prefix ‘[windows]’ --verbose yes
    Import finished.
  • But from UI i cant find the new templates even after refreshing

Tried via GIT -

Then I found this topic this reference: Verbose import and import not taking place · Issue #4 · theforeman/hammer-cli-foreman-templates · GitHub

Tried via again using another method:
hammer import-templates --repo ssh:// --prefix ‘[windows]’ --branch master --dirname / --associate always --verbose yes --force yes
Could not import

Can anyone point out what I am doing wrong?
Does the hammer import-template work for files on local directories??

Also watched this video the Deep Dive - Adding UI/UX Tested same commands. Also how do I get the Import/Export tab in the UI in 10:40 of the video…

for local install I tried:

hammer import-templates --repo /tmp/ForemanWindows

getting could not import message


not sure about the failing imports with the later commands, but I have a guess about why you cannot find the succeeded imports.
Newly imported templates are usually set up without org/loc associations. Try switching to any/any context on the templates page and check if they appear.

How do I switch to any/any??

By clicking the down arrow next to Default Organization/Location and then selecting Any Organization/Location.

Also you need to be admin for that.

I am using the admin account and still cant see the down arrow next to Default Organization/Location… am I on the wrong view??

But I typed organization = “Default Organization” and was able to see the imported templates…

I marked it red in the picture.

:scream: Sorry, I wear glasses and still failed to see that…


1 Like

That’s in fact valuable usability feedback :slight_smile: anyway, if you switch to “any context”, do you see templates even without the searching?

Yes, after switching to “any” context the number of template doubled. All the templates that I thought it failed to import are all showing now…


I need to learn how to import them directly into the right Org/Location