I'd like to copy a number of files from puppet:// urls to a directory on an agent. I'm not sure if I'm doing something wrong here, but it seems like puppet doesn't like this
file { '/etc/nginx/conf.d':
path => '/etc/nginx/conf.d',
ensure => directory,
require => File['/etc/nginx/nginx.conf'],
source => ['puppet:///modules/nginx/app1.conf',
'puppet:///modules/nginx/app2.conf'],
sourceselect => all,
}
Here's what I get when trying to run the agent
Error: Could not rename temporary file /etc/nginx/conf.d.puppettmp_9046 to /etc/nginx/conf.d: Is a directory
If I change things around a tiny bit by creating directories in the module, and pointing the resource at them it works
mkdir module/files/app1 module/files/app2
mv module/files/app1.conf module/files/app1
mv module/files/app2.conf module/files/app2
new resource
file { '/etc/nginx/conf.d':
path => '/etc/nginx/conf.d',
ensure => directory,
require => File['/etc/nginx/nginx.conf'],
source => ['puppet:///modules/nginx/app1',
'puppet:///modules/nginx/app2'],
sourceselect => all,
recurse => true,
}
It just seems a little silly to have to create directories to copy over a list of single files.
Edit
I tried adding a trailing slash on the path, but jumped the gun thinking this was the solution. The reason was I had my nginx class declaration commented out in the node definition. Trying it though I get the same error from above.
file { '/etc/nginx/conf.d/':
path => '/etc/nginx/conf.d/',
ensure => directory,
require => File['/etc/nginx/nginx.conf'],
source => ['puppet:///modules/nginx/app1.conf',
'puppet:///modules/nginx/app2.conf'],
sourceselect => all,
}