This was inspired by https://github.com/theforeman/puppet-foreman/blob/master/manifests/database/postgresql.pp#L25 , I'm not sure why, but it seems like something worth keeping (as the fact that it works now doesn't necessary mean that it works every time)