Richard Palmer
2008-Mar-18 09:24 UTC
[Puppet Users] Matching multiple nodes with a regular expression
Hello, I''m setting up puppet on various clusters (tomcat, mysql, tomcat +cocoon, etc) of computers, each of which has a hostname consisting of the cluster type and a unique id (e.g. tc-dev-1, mysql-stg-3, etc). I''ve been merrily adding each node by hand to puppet but being naturally lazy I wondered if this could be done with a regular expression instead, something along the lines of: nodematch "tc-liv-\d+.*?\.ac\.uk" { .... } which would then map all matching nodes to that default configuration. Adding the code to do this doesn''t seem to be a unsurmountable problem, but I''ve only just started reading through the source so perhaps I''m wrong. Does this seem worthwhile?, or is there a much easier way to do this that I''ve missed?. thanks, Richard. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Turnbull
2008-Mar-18 09:32 UTC
[Puppet Users] Re: Matching multiple nodes with a regular expression
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Richard Palmer wrote: | Hello, | | I''m setting up puppet on various clusters (tomcat, mysql, tomcat | +cocoon, etc) of computers, each of which has a hostname consisting of | the cluster type and a unique id (e.g. tc-dev-1, mysql-stg-3, etc). | I''ve been merrily adding each node by hand to puppet but being | naturally lazy I wondered if this could be done with a regular | expression instead, something along the lines of: | | nodematch "tc-liv-\d+.*?\.ac\.uk" { .... } | | which would then map all matching nodes to that default configuration. | Adding the code to do this doesn''t seem to be a unsurmountable | problem, but I''ve only just started reading through the source so | perhaps I''m wrong. Does this seem worthwhile?, or is there a much | easier way to do this that I''ve missed?. I think it might be harder than you think but I suspect Luke would welcome any contribution in this arena. But you can do something similar now using external nodes: http://reductivelabs.com/trac/puppet/wiki/ExternalNodes Regards James Turnbull - -- James Turnbull (james@lovedthanlost.net) - -- Author of: - - Pulling Strings with Puppet (http://www.amazon.com/gp/product/1590599780/) - - Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) - - Hardening Linux (http://www.amazon.com/gp/product/1590594444/) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFH34wu9hTGvAxC30ARAlLWAKDKiFg3jxwy+QP1PgZlfIJD1yl0ogCeOU9x rGfXeSdkubL76+w8HRA4ZVM=FJxw -----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 -~----------~----~----~----~------~----~------~--~---
Richard Palmer
2008-Mar-19 16:46 UTC
[Puppet Users] Re: Matching multiple nodes with a regular expression
Hi James, On Tue, Mar 18, 2008 at 9:32 AM, James Turnbull <james@lovedthanlost.net> wrote:> > I think it might be harder than you think but I suspect Luke would > welcome any contribution in this arena.I''ll give it a try.> > But you can do something similar now using external nodes: > > http://reductivelabs.com/trac/puppet/wiki/ExternalNodesAha. That''ll also solve the problem. The wiki seems to guard its secrets jealously. many thanks, Richard. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---