I''m looking for an easy way to include the list of applied classes on a host in something like /etc/motd. using an .erb template would do the trick if I an array exists that has all the classes in it? Hopefully it''s available? thanks -- 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.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1> I''m looking for an easy way to include the list of applied classes on > a host in something like /etc/motd. using an .erb template would do > the trick if I an array exists that has all the classes in it? > Hopefully it''s available?you find a list of the applied class on each host in /var/lib/puppet/state/classes.txt . However I''m not sure if this is the right approach, as for example for my environment on a moderate host I apply around 180 classes. This will happen very fast if you structure your code properly into modules and use inheritance to deal with os-specific things. I assume what you like to do is to display to a user logging into the machine, what is managed on this host, right? So maybe you should get this informaton out of something else than classes, as classes might only represent a small part of a bigger thing that is managed. I don''t know how you decide in your manifests what to manage on a host, however you might want to collect this information from there. cheers pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkuQsawACgkQbwltcAfKi38jOwCaA9Dl7K4d1QDw/fI1QM9qsBmo UtcAnRW+rS2dp8nv6e4HXi/zcDrDOMYT =82bO -----END PGP SIGNATURE----- -- 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.
you might be able to use the tags variable, however it will include tags that you defined in your manifests. Ohad On Fri, Mar 5, 2010 at 2:44 PM, jb <jeffbehl@gmail.com> wrote:> I''m looking for an easy way to include the list of applied classes on > a host in something like /etc/motd. using an .erb template would do > the trick if I an array exists that has all the classes in it? > Hopefully it''s available? > > thanks > > -- > 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.
I see your point...after looking at the classes.txt file it does have a lot more than what I want. I''m in particular looking for classes that affect app deployment/management for the engineers so they can easily see what is under puppet control...they don''t need to need to see the myriad of OS level classes that are applied. As the classes are defined via a mysql database (external node lookup script), I think the best way will be to use that same database somehow via another script run from the local host. I already call such a script to update the database with ''last puppet run'' so this shouldn''t be too much of an issue. thanks - jeff On Mar 4, 11:24 pm, Peter Meier <peter.me...@immerda.ch> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I''m looking for an easy way to include the list of applied classes on > > a host in something like /etc/motd. using an .erb template would do > > the trick if I an array exists that has all the classes in it? > > Hopefully it''s available? > > you find a list of the applied class on each host in > /var/lib/puppet/state/classes.txt . > > However I''m not sure if this is the right approach, as for example for > my environment on a moderate host I apply around 180 classes. This will > happen very fast if you structure your code properly into modules and > use inheritance to deal with os-specific things. > > I assume what you like to do is to display to a user logging into the > machine, what is managed on this host, right? So maybe you should get > this informaton out of something else than classes, as classes might > only represent a small part of a bigger thing that is managed. I don''t > know how you decide in your manifests what to manage on a host, however > you might want to collect this information from there. > > cheers pete > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > iEYEARECAAYFAkuQsawACgkQbwltcAfKi38jOwCaA9Dl7K4d1QDw/fI1QM9qsBmo > UtcAnRW+rS2dp8nv6e4HXi/zcDrDOMYT > =82bO > -----END PGP SIGNATURE------- 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.
This code loops all applied classes and if a class has a variable named "iptable_rule_chain" it prints its(the variable''s) content to the file. It raises some series scoping and ordering issues but I use it anyways as I prefer them over file concatenation(in some templates I use of 3 if these loops for 3 different variables - concatenating file would be a mess ). <% classes.each do |current_class| -%> <% if has_variable?(current_class + "::iptable_rule_chain") then -%> <%= scope.lookupvar(current_class + "::iptable_rule_chain") %> <% end -%> <% end -%> On Mar 6, 1:02 pm, "R.I.Pienaar" <r...@devco.net> wrote:> hello, > > The way I achieve this is using a concat tool[1] and a define like: > > class motd { > concat{"/etc/motd": > owner => root, > group => root, > mode => 644, > } > > concat::fragment{"modules_header": > target => "/etc/motd", > order => 9, > content => " Puppet Modules:\n", > } > > } > > define motd::register() { > concat::fragment{"motd_${name}": > target => "/etc/motd", > content => " - ${name}", > } > > } > > now later on in my apache module I just do: > > motd::register{"apache": } > > And the result - obviously not the entire thing is shown above: > > Welcome to Transient Atmospheric Phenomenon > hosted at Rapidswitch, Maidenhead, UK > > Puppet Modules: > - apache > - bind master server > - iptables > - mcollective member > > [1]http://www.devco.net/archives/2010/02/19/building_files_from_fragment... > > > > > > ----- "jb" <jeffb...@gmail.com> wrote: > > I see your point...after looking at the classes.txt file it does have > > a lot more than what I want. I''m in particular looking for classes > > that affect app deployment/management for the engineers so they can > > easily see what is under puppet control...they don''t need to need to > > see the myriad of OS level classes that are applied. > > > As the classes are defined via a mysql database (external node lookup > > script), I think the best way will be to use that same database > > somehow via another script run from the local host. I already call > > such a script to update the database with ''last puppet run'' so this > > shouldn''t be too much of an issue. > > > thanks - jeff > > > On Mar 4, 11:24 pm, Peter Meier <peter.me...@immerda.ch> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA1 > > > > > I''m looking for an easy way to include the list of applied classes > > on > > > > a host in something like /etc/motd. using an .erb template would > > do > > > > the trick if I an array exists that has all the classes in it? > > > > Hopefully it''s available? > > > > you find a list of the applied class on each host in > > > /var/lib/puppet/state/classes.txt . > > > > However I''m not sure if this is the right approach, as for example > > for > > > my environment on a moderate host I apply around 180 classes. This > > will > > > happen very fast if you structure your code properly into modules > > and > > > use inheritance to deal with os-specific things. > > > > I assume what you like to do is to display to a user logging into > > the > > > machine, what is managed on this host, right? So maybe you should > > get > > > this informaton out of something else than classes, as classes > > might > > > only represent a small part of a bigger thing that is managed. I > > don''t > > > know how you decide in your manifests what to manage on a host, > > however > > > you might want to collect this information from there. > > > > cheers pete > > > -----BEGIN PGP SIGNATURE----- > > > Version: GnuPG v1.4.9 (GNU/Linux) > > > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > > > iEYEARECAAYFAkuQsawACgkQbwltcAfKi38jOwCaA9Dl7K4d1QDw/fI1QM9qsBmo > > > UtcAnRW+rS2dp8nv6e4HXi/zcDrDOMYT > > > =82bO > > > -----END PGP SIGNATURE----- > > > -- > > 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. > > -- > R.I.Pienaar-- 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.
As I wrote <and misspelled> before "some serious scoping and ordering issues" ... On Mar 6, 2:21 pm, "R.I.Pienaar" <r...@devco.net> wrote:> hello, > > ----- "Oded" <oded.beno...@gmail.com> wrote: > > <% classes.each do |current_class| -%> > > this is order dependent, it only find classes already included before this template gets built.-- 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.