Hello puppetmasters- I have just begun converting over from an inhouse SCM solution to puppet. Puppet is so much sanier, thanks Luke. Documentation is solid but terse, this leads me to my question. We have under the previous system the host anems of the clients up to provide location adn machine number in a xxxxxx-xx format. Thus foo123-01 would be a the 01 machine in building foo, room 123. This works well for both letting us know where a machien is and waht room specific settign a machine needs such as printers. Facter gives me the hostname but I need to take the hostname and check only the building and room ( first 6 chars) against printer locations to assign the right printers to the right machines. Example: 1 Facter reports hostname as foo123-01 2 Clip first six char. for foobar 3 Compare foobar to printer list 4 Assign the corret printer. Steps 1,3 and 4 are very straight forward and implemented. It is getting from step 1 to step 2 that is throwing me. I do not see away to handle this in puppet. A facter module might be the correct solution, but I am having trouble making sense of it and Ruby is not currently on list of known languages. Evan ( Puppetmaster apprentice :) ) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mar 27, 2008, at 11:50 AM, Evan Hisey wrote:> Example: > 1 Facter reports hostname as foo123-01 > 2 Clip first six char. for foobar > 3 Compare foobar to printer list > 4 Assign the corret printer. > > Steps 1,3 and 4 are very straight forward and implemented. It is > getting from step 1 to step 2 that is throwing me. I do not see away > to handle this in puppet. A facter module might be the correct > solution, but I am having trouble making sense of it and Ruby is not > currently on list of known languages.I think the best option is to write a server-side function that does that work for you. See WritingYourOwnFunctions on the wiki. Basically, you''d call it like: $building = building($hostname) $room = room($hostname) ... -- Venter''s First Law: Discoveries made in a field by some one from another discipline will always be upsetting to the majority of those inside. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 got similar cases, not bound to rooms and printers, but to services and software packages that are needed on machines. Those could be extracted from the hostname. To solve this I use the external-nodes script and implement the logic in it. - - Phillip Evan Hisey schrieb:> Hello puppetmasters- > I have just begun converting over from an inhouse SCM solution to > puppet. Puppet is so much sanier, thanks Luke. Documentation is solid > but terse, this leads me to my question. We have under the previous > system the host anems of the clients up to provide location adn > machine number in a xxxxxx-xx format. Thus foo123-01 would be a the > 01 machine in building foo, room 123. This works well for both letting > us know where a machien is and waht room specific settign a machine > needs such as printers. Facter gives me the hostname but I need to > take the hostname and check only the building and room ( first 6 > chars) against printer locations to assign the right printers to the > right machines. > > Example: > 1 Facter reports hostname as foo123-01 > 2 Clip first six char. for foobar > 3 Compare foobar to printer list > 4 Assign the corret printer. > > Steps 1,3 and 4 are very straight forward and implemented. It is > getting from step 1 to step 2 that is throwing me. I do not see away > to handle this in puppet. A facter module might be the correct > solution, but I am having trouble making sense of it and Ruby is not > currently on list of known languages. > > Evan > ( Puppetmaster apprentice :) ) > > > >- -- Phillip Scholz Systems Administrator IT Freemail Karlsruhe 1&1 Internet AG Brauerstraße 48 D-76135 Karlsruhe Tel. +49-721-91374-4818 phillip.scholz@1und1.de http://www.1und1.de/ Amtsgericht Montabaur HRB 6484 Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Andreas Gauger, Thomas Gottschlich, Matthias Greve, Robert Hoffmann, Markus Huhn, Achim Weiss Aufsichtsratsvorsitzender: Michael Scheeren -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFH69tF1MyrzuZeshoRAjOqAJ9JFgT3tj7J338llPbjKglONfePfgCfdFbG okGZUUjbyj2TER3PraSE54A=CsmI -----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 -~----------~----~----~----~------~----~------~--~---
On Thu, Mar 27, 2008 at 11:50 AM, Evan Hisey <ehisey@gmail.com> wrote:> Hello puppetmasters- > I have just begun converting over from an inhouse SCM solution to > puppet. Puppet is so much sanier, thanks Luke. Documentation is solid > but terse, this leads me to my question. We have under the previous > system the host anems of the clients up to provide location adn > machine number in a xxxxxx-xx format. Thus foo123-01 would be a the > 01 machine in building foo, room 123. This works well for both letting > us know where a machien is and waht room specific settign a machine > needs such as printers. Facter gives me the hostname but I need to > take the hostname and check only the building and room ( first 6 > chars) against printer locations to assign the right printers to the > right machines. > > Example: > 1 Facter reports hostname as foo123-01 > 2 Clip first six char. for foobar > 3 Compare foobar to printer list > 4 Assign the corret printer.Just in case some one else has a similiar problem or I forget it, this is houw I solved it. I used the <% %> erb syntaxs to build a case statement in a printer template file. So the template looks something like this: <% case hostname when /dhcp/ %> <Printer Richards_Printer> Info Color Location ............. ErrorPolicy stop-printer </Printer> <% when /MIB333/ %> <Printer MIB333> Info LaserJet 4650N .............. ErrorPolicy abort-job </Printer> <% when /HOU120/ %> <DefaultPrinter Hou120> Info Location DeviceURI socket://130.160.35.11:9100 State Idle ........................ ErrorPolicy stop-printer </Printer> <%end %> This works very well for regreping the location for each printer out of the hostname. Evan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---