Using hostgroup in puppet and hiera lookup

I'm trying to find a way to use the hostgroup parameter that foreman
provides in puppet but that I'm not sure how:

puppet apply -e 'notify { $::hostgroup: }'

This only results in 'undef' and not the actual hostgroup. Any ideas how to
get the value?
Ultimately I want to use this in hiera.yaml so I can assign data according
to the hostgroup of the system.