Hi folks, For the first time since I started playing with puppet I started down the road of using exported resources This was inspired by my reading all of the nagios related recipes that went something along the lines of class nagios { package {nagios: ensure=> latest } service {nagios : ensure => running , enable => true} Nagios_host <<! !>> Nagios_service <<! |> class target { @@nagios_host { $fqdn: ensure => present, alias => $hostname, register => 1, use => "generic-host" } @@nagios_service { "check_ping_${hostname}": use => "check_ping", hostname => "$fqdn" } } Now, I''ve run into several issues. First off the exported resources never seem to get to get marshalled. Secondly on my Nagios_service <<! !>> statement puppet complains about the leading "<<" and says it expected "}" I''ve compared my work to the examples I''ve seen and I''m crosseyed now. Where am I going wrong here? -- Peter L. Berghold Owner, Shark River Technical Solutions LLC -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Jan 17, 2012 at 8:38 AM, Peter Berghold <salty.cowdawg@gmail.com> wrote:> Hi folks, > > For the first time since I started playing with puppet I started down the > road of using exported resources This was inspired by my reading all of the > nagios related recipes that went something along the lines of > > class nagios { > package {nagios: ensure=> latest } > service {nagios : ensure => running , enable => true} > > Nagios_host <<! !>> > Nagios_service <<! |> > > > class target { > @@nagios_host { $fqdn: > ensure => present, > alias => $hostname, > register => 1, > use => "generic-host" > } > > @@nagios_service { "check_ping_${hostname}": > use => "check_ping", > hostname => "$fqdn" > } > } > > > > Now, I've run into several issues. > > First off the exported resources never seem to get to get marshalled. > Secondly on my Nagios_service <<! !>> statement puppet complains about the > leading "<<" and says it expected "}"A quick glance, the syntax should be <<| |>> not exclamations !. Nan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Actually I am using "|" (pipes) and not exclamation marks in my actual recipe. Not sure why the exclamation mark showed up. :-/ On Tue, Jan 17, 2012 at 11:42 AM, Nan Liu <nan@puppetlabs.com> wrote:> On Tue, Jan 17, 2012 at 8:38 AM, Peter Berghold <salty.cowdawg@gmail.com> > wrote: > > Hi folks, > > > > For the first time since I started playing with puppet I started down the > > road of using exported resources This was inspired by my reading all of > the > > nagios related recipes that went something along the lines of > > > > class nagios { > > package {nagios: ensure=> latest } > > service {nagios : ensure => running , enable => true} > > > > Nagios_host <<! !>> > > Nagios_service <<! |> > > > > > > class target { > > @@nagios_host { $fqdn: > > ensure => present, > > alias => $hostname, > > register => 1, > > use => "generic-host" > > } > > > > @@nagios_service { "check_ping_${hostname}": > > use => "check_ping", > > hostname => "$fqdn" > > } > > } > > > > > > > > Now, I''ve run into several issues. > > > > First off the exported resources never seem to get to get marshalled. > > Secondly on my Nagios_service <<! !>> statement puppet complains about > the > > leading "<<" and says it expected "}" > > A quick glance, the syntax should be <<| |>> not exclamations !. > > Nan > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- Peter L. Berghold Owner, Shark River Technical Solutions LLC -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Here are the actual class definitions: class nagios::server inherits nagios { include gd case $operatingsystem { Debian: { include nagios::server::debian} Gentoo: { include nagios::server::gentoo} default: { } } Nagios_host <<| |>> Nagios_service <<| |>> } class nagios::server::debian { notify {"$fqdn : nagios::server::debian":} @package {nagios3:ensure=>latest} realize Package[nagios3] @service { nagios3: ensure=> running, enable=>true } realize Service[nagios3] } class nagios::server::target { @@nagios_host { "${fqdn}": alias => "${hostname}", ensure => present, register => 1, use => "generic-host", address => "${ipaddress}" } @@nagios_service { "${hostname}_ping": host_name => "${fqdn}", use =>"check_ping" } } -- Peter L. Berghold Owner, Shark River Technical Solutions LLC -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Jan 17, 2012 at 8:48 AM, Peter Berghold <salty.cowdawg@gmail.com> wrote:> Here are the actual class definitions: > > class nagios::server inherits nagios { > include gd > > case $operatingsystem { > Debian: { include nagios::server::debian} > Gentoo: { include nagios::server::gentoo} > default: { } > } > > Nagios_host <<| |>> > > Nagios_service <<| |>> > > > > } > class nagios::server::debian { > > notify {"$fqdn : nagios::server::debian":} > > @package {nagios3:ensure=>latest} > realize Package[nagios3] > > @service { nagios3: ensure=> running, > enable=>true > } > realize Service[nagios3] > > > > > } > > class nagios::server::target { > @@nagios_host { "${fqdn}": > alias => "${hostname}", > ensure => present, > register => 1, > use => "generic-host", > address => "${ipaddress}" > } > @@nagios_service { > "${hostname}_ping": > host_name => "${fqdn}", > use =>"check_ping" > > } > }Not sure since the new code passes puppet parse validate (if you are on 0.25 puppet --parseonly). If everything passes parse check the other possibility is you have exported resources that are invalid causing problems when the resources are collected (you can confirm this by commenting out the collected resources <<| |>>). Since you just started using exported resources, might be easiest to clear all exported resource, and try the nagios::server class itself without using nagios::server::target first. HTH, Nan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.