On Tue, Aug 23, 2011 at 3:09 AM, puppetlurker <[email protected]>wrote:
> This looks promising! I should be able to create a fact on some > servers, then collect those servers in a template. I'm going to > upgrade to test this out. > > Another option, just in case you dont want to upgrade your puppet installation / use storconfigs and you want to get results based on the state of your nodes (e.g. no stale nodes, nodes with errors etc) is to query foreman [1], a simple example of a puppet function can be found here [2] Ohad [1] - http://theforeman.org [2] - https://github.com/ohadlevy/puppet-foreman/blob/master/foreman/lib/puppet/parser/functions/foreman.rb Thanks, > > puppetlurker > > On Aug 22, 10:45 am, Nan Liu <[email protected]> wrote: > > On Mon, Aug 22, 2011 at 6:11 AM, puppetlurker > > > > > > > > > > > > > > > > > > > > <[email protected]> wrote: > > > Greetings, > > > > > I'm having an issue with my implementation of exported resources. I > > > have a memcache server pool, and want to update the /etc/php.d/ > > > memcache.ini with the ips of all the servers. Previously, I hard coded > > > the $memcacheservers array in the node manifest and the template > > > collected and populated the template. > > > > > Now that I'm moving to exported resouces, how do I get it to set an > > > array in a way I can access it from a different scope? I tried moving > > > the file { "/etc/php.d/memcache.ini": content => template(memcache/ > > > memcache.ini.erb) to the resource function (I understand exported > > > resources shoulld not define other resources), but it only populates > > > the first server collected, and complains about a duplicate resource > > > if I have more than 1 exported server. > > > > > I've tried defining the resource without the content the first time, > > > then override the define with the content, but that only picks up the > > > 2nd server. I've tried accessing the variable that gets populated > > > after the Memcache::Servers <<| |>> but it doesn't get populated in > > > this scope. I've tried looking up the > > > scope.lookupvar('memcached::servers::memcacheservers') but the > > > exported resource is a define not a class and I couldn't get it to > > > work. I've tried just using a script to populate the file with the > > > proper contents, but there is no way to ensure it is filled with all > > > the servers, for example the script is executed out of order, > > > replaced 3 times if there are 3 servers, and may contain 1, 2, or 3 > > > servers after a puppet run. > > > > > Any suggestions? > > > > I was looking at a similar issue where I need to export data, not > > resource, and be able to lookup the data. It just happens that Dan has > > published a prototype along the line of what you are looking for: > https://github.com/puppetlabs/puppetlabs-nodesearch > > > > Thanks, > > > > Nan > > -- > 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. > > -- 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.
