On Sep 22, 11:05 am, Douglas Garstang <doug.garst...@gmail.com> wrote: > On Thu, Sep 22, 2011 at 5:57 AM, jcbollinger <john.bollin...@stjude.org> > wrote: > > > On Sep 21, 6:34 pm, Nigel Kersten <ni...@puppetlabs.com> wrote: > >> On Wed, Sep 21, 2011 at 1:20 PM, Douglas Garstang > > >> <doug.garst...@gmail.com> wrote: > >> > All, > > >> > I have a situation where I need to get some fairly complex > >> > configuration files onto systems, and I'm wondering if puppet can even > >> > do this. Lets say that my external node script will go and source all > >> > the data it needs from an external database, and dump out all > >> > variables that the node will need. The relevant puppet module(s) will > >> > then have to inject these variables into templates to be deployed to > >> > the systems. > > >> Can you provide an example of a chunk of actual data and the desired > >> end result to see if there's a better alternative Doug? > > > I second that request. The scenario presented is more a design > > concept than a problem description. Although I am confident that > > Puppet indeed can handle the scenario as presented, it may be that > > there are alternative designs that would accomplish the same objective > > in a simpler way. > > Well, speaking somewhat generically still, we have an application that > will need to run multiple times on a single system, and each instance > of that running application will have it's own config file, each with > a variable number of items (they're disk volumes). > > If the external node script returned YAML data like this: > > appX_inst1_vol1_name: vol1 > appX_inst1_vol1_size: 1G > appX_inst1_vol1_active: true > appX_inst2_vol1_name: vol2 > appX_inst2_vol1_size: 2G > appX_inst2_vol1_active: false > > ... and so on. All the volumes for inst1 need to go into one config > file, all the volumes for inst2 in another config file and so on. I > don't see a way that puppet can iterate over a variable number of > items and split the data into multiple files.
Part of the question is why the ENC would structure the data that way in the first place. I don't use one, so perhaps I am displaying my ignorance, but can't ENCs assign hash and array values to variables? As any Perl hand will know, arrays and hashes are plenty to build data structures of arbitrary complexity. On the Puppet side, array resource titles, defined types, and create_resources() have enough power to pull that data back out, at least if you structure it with a bit of care. I think hiera could help go even further. John -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.