0

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 test1.example.com { netset::int::vconf {"servers" : label1 => { 'comment' => 'VIP Test1', 'ipaddress' => '192.168.1.10', 'netmask' => '255.255.255.0', 'int_label' => 'TEST1' }, label2 => { 'comment' => 'VIP Test2', 'ipaddress' => '192.168.1.11', 'netmask' => '255.255.255.0', '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){...do 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

1 Answer 1

0

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=>"192.168.1.1"; label2: comment=>"comment2", ipaddress=>"192.168.2.2"; } 

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.