In order to understand exported resources in Puppet the following documentation was read. After reading the documentation the understanding was that exported resources consist of declaring and collecting.


Based on the documentation and understanding of exported resources in Puppet the following code was created:

class test {
  @@file { "/tmp/$hostname": }

  File <<| |>>


The expectation was that a file /tmp/vm-one would be created


No file has been created

[vagrant@vm-one modules]$ sudo puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for vm-one.domain
Info: Applying configuration version '1421499164'
Notice: Finished catalog run in 0.10 seconds
  • Not sure about this, but I've seen Puppet 2.7 handle locally exported resources as simple virtual resources. Realize them using <<| |>> on remote nodes, but the local node must use <| |>. Might help, let me know (also, your Puppet version). – Felix Frank Jan 19 '15 at 13:25
  • @FelixFrank Puppet version: 3.7.3. I will try to make it work using <| |> and let you no the outcome. – 030 Jan 31 '15 at 17:42

For exported resources to function properly you need to set up PuppetDB. They won't work without PuppetDB. Also, you often need two Puppet runs for resources to get applied.

What happens behind the scenes is:

  • puppet agent requests catalog from master

  • master compiles catalog (fetching exported resources from PuppetDB, and storing newly found exported resources back to PuppetDB)

  • master delivers catalog to agent

Of course having exported resources within the manifest for a single node isn't really useful. The idea behind them is that individual nodes can report some of their resources which are later collected by another node on which you want them to be applied.

Here's an example: if want to insert Nagios checks into each and every one of your services, you don't want to apply and collect those checks on the nodes where services reside on, but you want to collect them all on a Nagios node.

Hope this helps.

  • Thank you for the explanation. At the company I have set up PuppetDB and I was thinking of using exported resources for Opsview that is using Nagios. At the moment we have to add hosts manually to Opsview and the aim is to automate this process, but at the moment I am looking for a working example because I do not understand how to implement it completely. – 030 Jan 17 '15 at 15:50
  • Is it possible to make distinctions between exported resources, e.g. if .development.domain then this file is applicable if .production.domain then that one. – 030 Jan 17 '15 at 15:55
  • Yes it is, you need to use tag param in your exported resources and then only collect those resources with that tag. – Jakov Sosic Jan 17 '15 at 20:31
  • Follow-up question – 030 Feb 15 '15 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.