I want to keep away as much as possible from defining these variables at the node level as they are more linked to the included classes.
I'm trying to set-up a monitoring module that looks at what classes(modules) have been included for that node and then deploys the required monitoring scripts. Being able to build an array of filenames based on 'if class is included' would do the trick quickly. I guess another way would be for me to start building custom facters of what a node is and then deploy the right files depending on the facter result. Anyone done similar? I always feel with puppet i'm missing something obvious :-) 2009/8/20 Ohad Levy <[email protected]>: > if you have a complex variables setup, I really recommend to move away to > external nodes(http://reductivelabs.com/trac/puppet/wiki/ExternalNodes) or > extlookup( > http://nephilim.ml.org/~rip/puppet/extlookup.rb) > > if you use external nodes, you could use an external source (e.g. a > database, or web service like GNI) to define your variables on a node level. > > my 0.01 cents > Ohad > > On Thu, Aug 20, 2009 at 9:34 PM, Matt <[email protected]> wrote: >> >> I saw that but I think that did something else. >> >> node "mynode" { >> include myclass, foo >> } >> >> node "mynode2" { >> include foo >> } >> >> class "foo" { >> if defined(Class['myclass']) {myvar = "hello"}) >> } >> >> Will both mynode2 and mynode get the variable myvar? In my case I >> only want mynode too. If both do, then I guess I need to use tagged >> as Larry said, but make sure that myclass is first in the include? >> >> Thanks, >> >> Matt >> >> 2009/8/20 James Turnbull <[email protected]>: >> > Matt wrote: >> >> I looked at the language tutorial but couldn't see it anywhere. >> >> >> > >> > You might be looking for the defined function. >> > >> > http://reductivelabs.com/trac/puppet/wiki/FunctionReference#defined >> > >> > Regards >> > >> > James Turnbull >> > >> > -- >> > Author of: >> > * Pro Linux Systems Administration (http://tinyurl.com/linuxadmin) >> > * Pulling Strings with Puppet (http://tinyurl.com/pupbook) >> > * Pro Nagios 2.0 (http://tinyurl.com/pronagios) >> > * Hardening Linux (http://tinyurl.com/hardeninglinux) >> > >> > >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
