On Wed, Aug 3, 2011 at 4:25 PM, Aaron Grewell <aaron.grew...@gmail.com>wrote:

> Example Config:
> ---
> :parser: YAML
> :precedence:
> - %{environment}/nodes/%{fqdn}
> - %{environment}/nodes/cluster_%{cluster}
> - %{environment}/nodes/site_%{site}
> - %{environment}/nodes/default
> :yaml:
>    :datadir: /usr/share/puppet/environments
>
> Example call:
> $default_packages = extlookup('linux_default_packages')
>
> Given an environment called 'testing', cluster called 'cluster1', site
> called 'site1' and a node called localhost.localdomain it will look for
> variable 'linux_default_packages' in:
>
> /usr/share/puppet/environments/testing/localhost.localdomain.yaml
> /usr/share/puppet/environments/testing/cluster_cluster1.yaml
> /usr/share/puppet/environments/testing/site_site1.yaml
> /usr/share/puppet/environments/testing/default.yaml
>
> In that order, which means you can set this at the default level, then
> override at any lower level you like.  Make sense?
>
>
>
Aaron, makes sense. I wasn't so interested in the defaulting behaviour,
because you can do the same thing with extlookup itself with something like
this:

$ssh_idle_timeout = extlookup("SshIdleTimeout", extlookup("SshIdleTimeout",
extlookup("SshIdleTimeout", "" ,"settings/nodes/_global"),
"settings/nodes/${domain}"), "settings/nodes/${fqdn}")

In fact, I haven't had a chance to think fully though it yet, but I think
this implementation of extlookup actually removes functionality. By chaining
extlookup() calls together like I have above you can determine what lookup
order you want to use whenver you want, rather than having to rely on a
centrally configured file.

But... I was much more interested in what I thought was the possibility of
storing complex YAML data and retrieving it with puppet. What does
$linux_default_packages end up looking like? Is it a string? If it's a
string, how do you parse it?

I dunno... seems like all you can store in the yaml files is key/value
pairs, which means it's no better than using a CSV file. No?

Doug

-- 
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.

Reply via email to