1

Access a puppet class variable dynamically

view story
linux-howto

http://serverfault.com – Is it possible to dynamically access a variable in a class? For example: class namespace::hello() { $cow = "moo" $dog = "bark" } $dynamic = 'cow' $value = $namespace::hello::[$dynamic] # doesn't work I'm doing this because I have classes defined with variables in them for each environment, e.g.: class company::env::production { $dns = "1.2.3.4" } class company::env::office { $dns = "2.3.4.5" } (HowTos)