fixes #6861 - properly detect host group provisioning in the templates

Needs https://github.com/theforeman/foreman/pull/1637, but should be backwards compatible w/ older versions too.
The idea here is in hostgroup provisioning, we won't have a cert name, but we might as well configure puppet correctly if the $HOSTNAME is set correctly as an environment variable.   This works if puppet autosign.conf is configured right.