About | FAQ | Help
Ask Your Question
0

Sending an array of files to a host

asked 2014-06-26 10:11:37 -0500

starkb gravatar image

I have about a 50 files that I need to copy to the hosts, so insted of listing a file resource for each one I want to create an array and use the file resource. I have seen many exapmles out on the web, but they don't work. I already have my directory created with a 775 and just want to add the files to it. I'm using the latest version of puppet.

This is an example of what I'm trying to do.

class test{
$file_array = ['test1.ini','test2.ini' etc.]

copyfiles {$file_array:
files_path => $file_array, 
   }
}

define test::copyfiles($files_path){

file {$name:
source => [$files_path],
mode => '0640',
group => 'root',
user => 'root',
sourceselect => 'all',
  }
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-04 12:43:21 -0500

binford2k gravatar image

This use case is exactly what the recurse attribute was designed for! Just manage a directory of files and it will be copied recursively.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-26 10:11:37 -0500

Seen: 162 times

Last updated: May 04