Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use a hash for the first time in puppet, so in my nodes.pp I'm going to use this:

node {
    netset::int::vconf {"servers" :
        label1 => { 'comment' => 'VIP Test1', 'ipaddress' => '', 'netmask' => '', 'int_label' => 'TEST1' },
        label2 => { 'comment' => 'VIP Test2', 'ipaddress' => '', 'netmask' => '', 'int_label' => 'TEST2' },

In the file /etc/puppet/modules/netset/int/vconf.pp that I am writing I'm creating a defined type:

define netset::int::vconf ($comment,$ipaddress){ somethings...}

My questionis how do I pass each keys of the hashes to the defined type? Somehow I'm imagining I'm going to have to create a loop somewhere, any help would be of great assistance.

Thanks Dan

share|improve this question

You are defining it in the wrong way, I believe.

If you have:

   define netset::int::vconf( $comment='', $ipaddress='' ) {

then, you should define multiple instances with

   netset::int::vconf {
       label1: comment=>"comment1", ipaddress=>"";
       label2: comment=>"comment2", ipaddress=>"";

Where label1 and label2 are the namevar. Note the trailing semicolon between defines.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.