Fixes #4398 Refactor ForemanHooks to be usable from a cookbook