Hey, Hope someone can help shed some light on this. I''m written a class that installs various software packages that we use in our organisation, and configures them to how we like. I''m trying to use a tag to determine which type of config to apply, so we can just tag a load of nodes with one thing, and have the right software and config automatically applied. The class is structured like so (simplified): class my_class { class my_software { if tagged("my_tag_1") { notify{"Tagged as my_tag_1": } Install config A } else if tagged("my_tag_2") { notify{"Tagged as my_tag_2": } Install config B } else { notify{"Not tagged": } Install default config } } } Then on a node you''d do the following to have a particular software package installed and configured based on the tag: In site.pp node ''servername.com'' inherits default { tag(my_tag_1) include my_class::my_software } After running Puppet through a catalog, the software is installed correctly Now the software installs properly, but it logs that it is using the default config, so the tag being assigned in the site.pp is obviously not being detected right? If anyone can shed any light on this that would be really appreciated :) Thanks in advance! Ryan -- 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.
Ohad Levy
2010-Feb-26 18:24 UTC
Re: [Puppet Users] Using tags in custom classes, and their scope
while its possible to use tags, I would recommend you using variables (either with external nodes or extlookup). cheers, Ohad On Fri, Feb 26, 2010 at 7:23 PM, RyanC <ryan@rjc.cc> wrote:> Hey, > > Hope someone can help shed some light on this. I''m written a class > that installs various software packages that we use in our > organisation, and configures them to how we like. I''m trying to use a > tag to determine which type of config to apply, so we can just tag a > load of nodes with one thing, and have the right software and config > automatically applied. > > The class is structured like so (simplified): > > class my_class > { > class my_software > { > if tagged("my_tag_1") > { > notify{"Tagged as my_tag_1": } > Install config A > } > else if tagged("my_tag_2") > { > notify{"Tagged as my_tag_2": } > Install config B > } > else > { > notify{"Not tagged": } > Install default config > } > } > } > > Then on a node you''d do the following to have a particular software > package installed and configured based on the tag: > > In site.pp > > node ''servername.com'' inherits default > { > tag(my_tag_1) > include my_class::my_software > } > > After running Puppet through a catalog, the software is installed > correctly > > Now the software installs properly, but it logs that it is using the > default config, so the tag being assigned in the site.pp is obviously > not being detected right? > > If anyone can shed any light on this that would be really > appreciated :) > > Thanks in advance! > Ryan > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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.
RyanC
2010-Mar-04 15:06 UTC
[Puppet Users] Re: Using tags in custom classes, and their scope
I decided to do that instead yeah! Thanks! On Feb 26, 6:24 pm, Ohad Levy <ohadl...@gmail.com> wrote:> while its possible to use tags, I would recommend you using variables > (either with external nodes or extlookup). > > cheers, > Ohad > > > > On Fri, Feb 26, 2010 at 7:23 PM, RyanC <r...@rjc.cc> wrote: > > Hey, > > > Hope someone can help shed some light on this. I''m written a class > > that installs various software packages that we use in our > > organisation, and configures them to how we like. I''m trying to use a > > tag to determine which type of config to apply, so we can just tag a > > load of nodes with one thing, and have the right software and config > > automatically applied. > > > The class is structured like so (simplified): > > > class my_class > > { > > class my_software > > { > > if tagged("my_tag_1") > > { > > notify{"Tagged as my_tag_1": } > > Install config A > > } > > else if tagged("my_tag_2") > > { > > notify{"Tagged as my_tag_2": } > > Install config B > > } > > else > > { > > notify{"Not tagged": } > > Install default config > > } > > } > > } > > > Then on a node you''d do the following to have a particular software > > package installed and configured based on the tag: > > > In site.pp > > > node ''servername.com'' inherits default > > { > > tag(my_tag_1) > > include my_class::my_software > > } > > > After running Puppet through a catalog, the software is installed > > correctly > > > Now the software installs properly, but it logs that it is using the > > default config, so the tag being assigned in the site.pp is obviously > > not being detected right? > > > If anyone can shed any light on this that would be really > > appreciated :) > > > Thanks in advance! > > Ryan > > > -- > > 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<puppet-users%2Bunsubscribe@google groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/puppet-users?hl=en.-- 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.