Reputation: 11
I am trying to write a simple resource to copy the content of a dire tory from puppet master to puppet agent.
file { "/usr/local/scaligent/" :
ensure => 'directory',
source => "puppet:///modules/toolchain",
recurse => 'true',
#owner => 'root',
#group => 'root',
#mode => '0755',
}
source is /etc/puppetlabs/code/environments/production/modules/files/toolchain/ in puppet master and destination is /usr/local/scaligent/ in puppet agent.
getting below error in puppet agent:
[~]$ sudo puppet agent -tv --noop
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Applying configuration version '1600365429'
Error: /Stage[main]/Main/File[/usr/local/scaligent/]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/toolchain
Notice: Applied catalog in 0.04 seconds
[ ~]$
Upvotes: 1
Views: 998
Reputation: 180058
Per the Puppet resource type reference, the form of a puppet:
URI is
puppet:///modules/<MODULE NAME>/<FILE PATH>
It refers to the content of a file or directory in a module, where Puppet will look for it in that module's files
directory. The file system path would be something like /etc/puppetlabs/code/environments/production/modules/<MODULE NAME>/files/toolchain
The URI you are trying to use, puppet:///modules/toolchain
, is not well formed, and the path you are trying to reference is not in any module's files/
directory.
It would be conventional, albeit not required, to put the "toolchain
" directory among the files of the module containing the resource declaration. But then, it would also be conventional to put the File
declaration in a class, in a module, which you have not done. There are approximately zero circumstances under which it would be good style to declare that resource at top scope, as it appears you have done.
Upvotes: 2