On Oct 1, 2008, at 8:02 AM, udo waechter wrote: > Hello everybody, > I have a question regarding virtual resources and the exporting/ > collection thereof. > > I have several hosts that should export one and the same file > resource. This should be collected exactly once by one host. > The resources are exported within a define: > > ## this define is used by many hosts. > ## example: sge::queue{"testqueue": ensure => present } > define sge::queue(...){ > @@file{"/var/lib/puppet/exported/sge/queue.template.${queue_name}": > content => template("sge/queue.template.erb"), > tag => "sge_queue_template", > } > } > > ### one host should import the File resource above. > class queue_collect{ > File <<| tag == "sge_queue_template" |>> > #there should be exactly one file: > # /var/lib/puppet/exported/sge/queue.template.testqueue > } > > How would I do this? If I simply do the examples above, I get the > "cannot override local resource" error on the host which is in the > queue_collect class. > > I would like to know how I could have many hosts export the > "same" (as in identical) resource. Is this possible?
As with non-exported resources, you can't have multiple instances of the same resource. How would it even make sense to have multiple hosts trying to create the same file on a given machine? Who would win? > > Looking into the database (resources table), it becomes clear that > every exporting host's resource is different, since it has different > "host_id"s. Their meaningful data (esp. the path) are the same. > > I have a similar problem with "Exec" resources, but ther I have the > "onlyif" parameter with a test that prefents execution if the exec > has already been applied on the collecting node. This is not > possible for the File resources though. > > Could it be that exporting via @file{...} and collecting with > realize(...) would solve this issue? I do not really understand the > use of this approach, I must confess. One '@' is virtual -- doesn't use Storeconfigs and doesn't allow multiple hosts to have access to the resource. 'realize' is exactly equivalent to a query like you're doing above, except for virtual (rather than exported) resources. -- The whole secret of life is to be interested in one thing profoundly and in a thousand things well. -- Horace Walpole --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---