[Puppet Users] confused about exported resources

2010-09-22 Thread Baker, Luke
I've been looking at this example in the puppetdocs.pdf

class nagios-target {
@@nagios_host { $fqdn:
ensure = present,
alias = $hostname,
address = $ipaddress,
use = generic-host,
}

@@nagios_service { check_ping_${hostname}:
check_command = check_ping!100.0,20%!500.0,60%,
use = generic-service,
host_name = $fqdn,
notification_period = 24x7,
service_description = ${hostname}_check_ping
}

}
class nagios-monitor {
package { [ nagios, nagios-plugins ]: ensure = installed, }
service { nagios:
ensure = running,
enable = true,
#subscribe = File[$nagios_cfgdir],
require = Package[nagios],
}

# collect resources and populate /etc/nagios/nagios_*.cfg
Nagios_host ||
Nagios_service ||

How is /etc/nagios/nagios_*.cfg populated using these two exported resources?

A more general question is that I'm confused on the purpose of exported 
resources. One of the other examples in the puppetdocs.pdf is

node a {
@@file { /tmp/foo: content = fjskfjs\n, tag = foofile, }
}

node b {
File | tag == 'foofile' |
}

In this case, wouldn't you be better off creating the '/tmp/foo' resource and 
placing or including it in your default node or whichever node you want to 
apply it to?

--Luke Baker

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



Re: [Puppet Users] confused about exported resources

2010-09-22 Thread Joe McDonagh



On 09/22/2010 09:10 AM, Baker, Luke wrote:


I've been looking at this example in the puppetdocs.pdf

class nagios-target {

@@nagios_host { $fqdn:

ensure = present,

alias = $hostname,

address = $ipaddress,

use = generic-host,

}

@@nagios_service { check_ping_${hostname}:

check_command = check_ping!100.0,20%!500.0,60%,

use = generic-service,

host_name = $fqdn,

notification_period = 24x7,

service_description = ${hostname}_check_ping

}

}

class nagios-monitor {

package { [ nagios, nagios-plugins ]: ensure = installed, }

service { nagios:

ensure = running,

enable = true,

#subscribe = File[$nagios_cfgdir],

require = Package[nagios],

}

# collect resources and populate /etc/nagios/nagios_*.cfg

Nagios_host ||

Nagios_service ||

How is /etc/nagios/nagios_*.cfg populated using these two exported 
resources?


That's the syntax for collecting resources. This is the classic example- 
every node gets the exported resource (the one with @@ in front of it), 
which means it is marked in the database as exported. Then on your 
nagios server you use the collection syntax to collect all the exported 
resources of that type. This means you can auto configure daemons like 
nagios that require node information for the configuration.


A more general question is that I'm confused on the purpose of 
exported resources.



The purpose is to distribute information between nodes. The second 
example you gave is pretty useless, but another common scenario is a 
command and control server that needs the proper host keys for your 
nodes. In each node's config you would export the ssh key and then 
collect it on the CC server, that way none of your scripts are failing 
because of the wrong host keys.



--
Joe McDonagh
Operations Engineer
AIM: YoosingYoonickz
IRC: joe-mac on freenode
When the going gets weird, the weird turn pro.

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