Hi all,
With the goal of making my code a little more DRY, I am trying to define 
resource parameters in an array of hashes, and then create defined 
resources from these array items. I am having trouble figuring out the 
syntax for accessing the hash values for the hash currently being worked on 
("self?").

Here's the code to make it clear:

##### Configuration arguments

$sites = [{
    sitedomain => 'site1.domain.dev',
    repo => 'git@repo.address/Repo',
    branch => 'develop',
    serveralias => "",
    priority => '010'
  },{
    sitedomain => 'site2.domain.dev',
    repo => 'git@repo.address/Repo',
    branch => 'develop',
    serveralias => "",
    priority => '020'
  },]

#### Deploy configuration

apache::vhost { $sites :
  priority => ${????}[priority],
  sitedomain => ${????}[sitedomain],
  serveralias => ${????}[serveralias],
}
git::clone { $sites :
  repo          => ${????}[repo],
  branch        => ${????}[branch],
}

How do I access the hash values for the current hash? (trouble spots marked 
with "????").

I've experimented a lot while reading documentation and these forums, but 
didn't get anywhere. I tried assigning each hash to a variable, but I still 
can't get at that variable's name from within resource definition.

Is what i'm trying to do even possible? Or am I stuck copying and pasting 
the roughly identical block of code for every site that needs to be present 
on the server?

Thank you in advance for any insight.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to