I'm using Hiera with Puppet and I want to pass the same parameter value to multiple classes without repeating it. Right now I've got (in Yaml):
---
class_a::database_server: myoraclebox.example.com
class_b::database_server: myoraclebox.example.com
This works, but how can I specify the server only once and still use Puppet's automatic parameter lookup? (I'd rather not embed an explicit Hiera lookup in my manifest, since that would couple it to Hiera.)
Using a & YAML anchor should work
Use the
hiera()
function to do a lookup as default values:This uses the full Hiera machinery to do the lookup for you.