On May 31, 2007, at 9:36 AM, Harold Ditchfield wrote:
> I would like to do a case statement based on different vlans. If a
> person does a case statement on $ipaddress provided by facter,
> can you match regex expressions such as
>
> case $ipaddress {
> "192.168.1.[0-9]+":
> do something
> "192.168.2.[0-9]+":
> do something else
> }
I''ve often considered this, but it would just be directly importing
regexes from Ruby, and the more of that I do, the more Puppet just
looks like Ruby.
In addition...
> Also, would this best be solved by a case statement or other
> functionality within puppet?
Generally, I think it''s best to make this kind of decision once --
most of these decisions split hosts into different classes, and if
you make that split once in the beginning of your configuration, then
you can reuse the information throughout.
E.g., you could have network names and have a server-side function to
pick ''net1'' or ''net2'' or whatever.
--
Never esteem anything as of advantage to you that will make you break
your word or lose your self-respect. -- Marcus Aurelius Antoninus
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com