Printing all templates to a subdirectory? Diffing templates?

Problem:

Is there a way with Hammer to print all templates to a directory on the host?

My problem: I have is that we’ve had to customize a bunch of templates to workaround past deficiencies in the existing templates. But most Foreman upgrades fix the templates, and thus as we update Foreman to new versions some of our custom templates are no longer needed. Sometimes, we want to keep our local templates but we simply want to incorporate any upstream changes so that our local templates don’t fall too far behind.

However, it’s hard to diff the templates to figure out how our templates are different.

Does anyone have a convenient way to print all Foreman templates to files to structured subdirectories so that we can compare two templates using CLI tools?

I know I can do things like this, but I was hoping to avoid writing my own tool:

% hammer template dump --id 116 > tmp/116.erb
% hammer template dump --id 27 > tmp/27.erb
% diff tmp/116.erb tmp/27.erb

Foreman and Proxy versions:

Foreman 2.5.4

Distribution and version:

Ubuntu 18.04

Hi,
if you’re not set on using hammer, the foreman_templates plugin should be able to export templates en-masse. Foreman :: Plugin Manuals

1 Like

I’m not set on using Hammer. I just it was my “only tool”. I’ll check out the “Foreman Templates” plugin.