CGIV-3821: Switched order of template generation
CGIV-3821: Restart service if we change any of the templates