Problem:
I have inadvertently purged (almost) all deployment templates and snippets.
My deployment templates included a lot of cruft from previous imports of the community-templates repository, prior to its reorganisation. I would like to restart with a more selective set of suitable templates.
Expected outcome:
I would like to get back to the default set of templates and snippets that are shipped with foreman-core.
Foreman and Proxy versions:
1.21 on Debian amd64 via packages
if I understand your request correctly, just run foreman-rake db:seed. All templates we ship (and are locked for editting) will be overridden to default content. This happens automatically with every upgrade. People who modify templates are suggested to clone them first instead of unlocking. There used to be a logic that if we saw some audit records, we wouldn’t reseed the template, but IIRC that’s gone and default templates are always updated.
It seems to have populated the table with all of those templates we have ever used, but none of the snippets that are still required by some of those templates.
Thanks both for the replies. I really thought that the filter by organization/location was going to reveal them all, but it turns out that I was already on a view with the organization==any and location==any filter applied.
I have also checked the same thing with hammer template list and it shows the same list.
This logic is actually there which is likely the reason they were not reimported.
You could try deleting the audits removing the templates from the db then rerun the foreman-rake db:seed task
OK, that’s great. Thanks @tbrisker I will try it. Is there an easy way to remove the audits, or should I just use a psql cli and truncate the audits table?
Should we continue skipping some templates that have audits records? I suppose it would make more sense to always enforce the up to date version for also snippets. The reason probably was that users can’t use their own snippets easily, their names are hardcoded in main templates. But it looks quite confusing now. Or we should provide a button “reset all snippets/templates” to default.