Looking at Puppet for a new installation. Wondering about the following capability: Say I have a reference to some definition, where I call out a relationship: silo( webservers => "server1", databaseservers => "server2" ); (sorry if syntax is incorrect). Is it possible for the definition of this to trigger "server1" to be in a "webservers" class and invoke webserver "appropriate" things, and "server2" to do likewise for database server things? In other words, can you program "self-identifification" of a host based on it being referenced as a member of an instantiation? Sorry if this is obvious, new to the language. A URL reference to the info would be appreciated. Thanks. -Alan -- Alan Sparks, UNIX/Linux Systems Integration and Administration <asparks@doublesparks.net>
Alan Sparks a écrit :> Looking at Puppet for a new installation. Wondering about the following > capability: > > Say I have a reference to some definition, where I call out a relationship: > silo( webservers => "server1", databaseservers => "server2" ); > (sorry if syntax is incorrect). > > Is it possible for the definition of this to trigger "server1" to be in > a "webservers" class and invoke webserver "appropriate" things, and > "server2" to do likewise for database server things? In other words, > can you program "self-identifification" of a host based on it being > referenced as a member of an instantiation? > > Sorry if this is obvious, new to the language. A URL reference to the > info would be appreciated. Thanks. > -Alan >you have to add tag(webservers) into your define so it tag the node but my tests show that tagging inside a define does not work quite well for me as my other defines does not sees it ( i use case tagged(webservers) { ... ). For now i use the tag in my nodes perhaps there is a way to tell this in a better way but as you i tried to make the define tag a server but it does not work as i wanted. -- Cordialement, Ghislain _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Tue, Jan 30, 2007 at 07:01:29AM -0700, Alan Sparks wrote:> Looking at Puppet for a new installation. Wondering about the following > capability: > > Say I have a reference to some definition, where I call out a relationship: > silo( webservers => "server1", databaseservers => "server2" ); > (sorry if syntax is incorrect). > > Is it possible for the definition of this to trigger "server1" to be in > a "webservers" class and invoke webserver "appropriate" things, and > "server2" to do likewise for database server things? In other words, > can you program "self-identifification" of a host based on it being > referenced as a member of an instantiation?If the webservers are in the class "webservers", you can use the automatic tag created with conditionals within a component or class to take different actions based on the type of node. (You can also explicitly create tags.) So you would have something like this: node server1 { include webserver include silo } node server2 { include databaseserver include silo } class silo { if tagged(webserver) { ... } if tagged(databaseserver) { ... } } xn