0

I have started to play with puppet 5 and for some reason the source attribute in the puppet file resource is not working. I have a simple manifest file in my puppet server which is as follows:

file {'/tmp/motd':
  source => '/tmp/motd',
}

On the agent, I issue:

puppet agent -t

which errors out as:

Error: /Stage[main]/Main/File[/tmp/motd]: Could not evaluate: Could not retrieve information from environment production source(s) file:/tmp/motd

The file motd exists on the puppet server in /tmp/ directory

Any idea what might be going on here?

If I replace source attribute with content => 'Testing 1 2 3', the puppet agent -t runs successfully creating a catalogue and I see the file motd on the client with the content Testing 1 2 3

hypersonics
  • 223
  • 5
  • 10

1 Answers1

2

source => '/tmp/motd' refers the local file /tmp/motd on the Puppet node as source. To get a file from Puppet Master, use a puppet:// URL. Per default all files directories of Puppet modules are accessible through puppet:///modules/${module_name}/<filename>.

sborsky
  • 315
  • 1
  • 6
  • **Note:** You could also use the [`file()` function](https://puppet.com/docs/puppet/latest/function.html#file) to return the contents of a file from disk. – Aaron Copley Oct 25 '17 at 05:47