Did you consider using a hash? $x = { 'app1' => 'app1user1,app1user2', 'app2 => '...' } $group = 'app1' $y = split($x[$group], ',')
In the DSL it is not possible to reference a variable in a dynamic way (i.e. compute the variable name), but you can compute a hash key.
e.g. $group_nrb = 1 $y = split($x["app${group_nbr}"], ',') Hope that helps - henrik On 2012-15-10 14:12, rvlinden wrote:
Hi all, I'm wondering if puppet can create a variable based on another variable ?? Here is an example 3 global varibles $::gbl_users_groups = app1,app2 $::gbl_users_accounts_app1 = app1user1,app1user2 $::gbl_users_accounts_app2 = app2user1,app2user2 What does work is this $groups_name_array = split($::gbl_users_accounts_app1,',') or $groups_name_array = split($::gbl_users_accounts_app2,',') What I really want to do, is replace the static app1 and app2 within the $groups_name_array, to something dynamic like this $groups_array = split($::gbl_users_groups,',') $groups_name_array = split($::gbl_users_accounts_*$groups_array*,',') If have tried various combination, but just can seen to find the right one (if it is possible) Any suggestions Regards, Rene -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/OROoQBAoDCUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.