Resources Loop

61 views
Skip to first unread message

Robert Smith

unread,
Mar 6, 2012, 7:26:27 PM3/6/12
to puppet...@googlegroups.com
Hello,

I'm fairly new to Puppet.  I'm trying to setup some Nagios checks for systems that have additional vhosts or aliases assigned to them (Nagios is already setup and running without issue).  In my node manifest, I have defined:

$nagios_http_alias_check = ["foo1","foo2","foo3"]

And in my apache class I have:

# in case there is no aliases listed, just use the hostname
$nagios_http_alias_list = default_value($nagios_http_alias_check,$hostname)

  define create_nagios_http_checks {
    @@nagios_service {"check-http_$nagios_http_alias_list":
      use           => 'check-http',
      host_name     => $nagios_http_alias_list,
      servicegroups => 'all-service-checks,http-checks'
    }
  } 

  create_nagios_http_checks { $nagios_http_alias_list: }

However, when I run puppet, I get an error due to the $nagios_http_alias_list mashing all the strings into one:

Duplicate definition: Nagios_service[check-http_foo1foo2foo3] is already defined in file

I know I'm doing something stupid, but I can't figure it out.  Any help greatly appreciated.

Krzysztof Wilczynski

unread,
Mar 7, 2012, 2:50:07 PM3/7/12
to puppet...@googlegroups.com
Hi,

[...]

I know I'm doing something stupid, but I can't figure it out.  Any help greatly appreciated.


Look this small example:

matti@acrux ~ $ cat - | puppet 2> /dev/null
$array = ['abc', 'def', 'xyz']

define iterator {
  notice "You have said: ${name}"
}

iterator { $array: }^D
notice: Scope(Iterator[abc]): You have said: abc
notice: Scope(Iterator[def]): You have said: def
notice: Scope(Iterator[xyz]): You have said: xyz
notice: Finished catalog run in 0.05 seconds
matti@acrux ~ $

I hope that helps :-)

KW
Reply all
Reply to author
Forward
0 new messages