6

I'm trying to copy folder /vagrant/scripts and its sub-folders located on puppet master into the agent. I use the following config in the init.pp:

file {
'/home/vagrant/scripts':
  ensure => 'file',
  source => 'puppet:///modules/ycsb/scripts',
  path => '/home/vagrant/YCSB/scripts',
  owner => 'vagrant',
  group => 'vagrant',
  mode  => '0744', # Use 0700 if it is sensitive
}

When I check the agent I can see /scripts folder but without its sub-folders. Any idea why this happens?

hossein
  • 181
  • 1
  • 1
  • 8

1 Answers1

10

I just found out the problem. First, instead of 'file' use 'directory' at ensure parameter . Second, make the copy process recursive to include all sub-folders.

file { 
 '/home/vagrant/scripts':
  ensure => 'directory',
  source => 'puppet:///modules/ycsb/scripts',
  recurse => 'remote',
  path => '/home/vagrant/YCSB/scripts',
  owner => 'vagrant',
  group => 'vagrant',
  mode  => '0744', # Use 0700 if it is sensitive
}
hossein
  • 181
  • 1
  • 1
  • 8