Well... Inline templates are a little bit dirty to do this, but they will work.
We are doing something similar so we can set up the interfaces of a host based on the group it belongs too. We created a module called custom and there we added in the lib directory as part of the facts a bunch of ruby files. A ruby file for mapping (all the CIDRs). and then a few libraries to use the ipaddr ruby lib and do calculations etc. Then we generated facts, that will use those libraries based on the ip that is being passed to the fact. and generate information like network info, gw, netmask, etc. I hope this helps. On Jan 28, 7:12 am, Nick Moffitt <[email protected]> wrote: > Martijn Grendelman: > > > Would you be so kind to post the solution you cho(o)se in the end? I am > > interested in this too.. Thank you! > > At the moment I'm attempting something like a case statement that does > inline_template("<%= require 'ipaddr'; > IPAddr.new('$thecidr').include?IPAddr.new('$theip') -%>") > a whole lot, and compares the output at each step. Hideous, but it's > enough that I've kind of put it on the back burner for now. > > -- > "Man, if everything were object-oriented then rsync > could do this already. Of course, if everything were > object-oriented I'd have a bushy moustache and be > wearing flares, which would suck." -- Sean Neakums -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
