Hello! I''m writting system for managing our customers'' networks. Each network could have diffirent options turned on - ie.: backup server, or mail server, or windows clients management, samba server etc. etc. I wrote small ui in ruby on rails, which allows technincas just click to provide some new functionality, or to configure it. To "glue" db with puppet using external node script. My question is: how you handle complex data structures in such a situation? Simple example is: backup. You have to say what to backup (host + path) and how to backup it (schedule, pools etc. - bacula stuff). And you REALLY need those data together to generate config file for backup system. Another example: dhcp server. You have to pull from db mac, ip address and hostname - and you build dhcpd.conf with host definitions. Another example: iptables rules. You get data from db about what to block/allow. And you build some chains in iptables based on this data Another example: wpkg configuration. You need to know what hosts should be configured, what profiles should be attached to those hosts, and what packages should be attached for each profile. Etc. etc. Each time you have the same pattern - you have to in some way get data from some kind of database (mysql, ldap, .csv files - whatever!) and then you have to use those data together, as kind of object, or structure, in manifests and templates. Currently I do this in this way: * external nodes script get data out of db * wherever I need "complex" data - this scirpts setup variable with YAML data inside * if I need to use those data: * in manifests - I have custom function, where I give variable with YAML data as 1 parameter, and then some kind of ruby expression to get data out of YAML. Function just converts YAML to ruby data structure and then evals given expression to get data. Output should always be either string, or array of strings. Then I can use this data (esp. arrays) in puppet manifests, ie.: to create many files based on db content. * in templates - it''s very simillar, but I still haven''t figured out how to use custom functions in templates - so I just require yaml module, convert YAML to ruby data structure and use that inside template (after all - it''s just ruby there :), Good thing in this solution is - it works. Bad thing - it''s very fragile... So how you people do things like that? Are they better way to do this? What they are? Bye, --- Grzegorz Marszałek graf0@post.pl --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---