[Puppet Users] Re: Copying multiple files to multiple locations

Rahul Khengare
Mon, 12 Aug 2013 12:07:17 -0000

Hi Matthijs,
  You can try using array variable in file resource.This may solve your
issue. Can you explain in detail. I mean the location of files and
directory structures.

If you want to copy the same file content in several files refer following
code snippet,You can use various files path  in array.
$file_names =
[''/root/t1'',/root/t2'',/root/t3'',/root/t4'']

file { $file_names:
  ensure => file,
  content => ''xyz'',
}

You can also use source => ''/root/xyz.txt'' tag/attribute of
file resource
for coping whole file.
This copied the ''xyz'' content in all the files present in
$file_name array
variables.


Thanks & Regards,
Rahul Khengare,

NTT DATA OSS Center Pune, India.**





On Friday, August 9, 2013 7:36:42 PM UTC+5:30, Matthijs Suringa
wrote:
>
> Hi,
>
> I''m, still relatively new to Puppet, so there might be something I
am
> overlooking.
> Anyway, my situation is that I can install 1 or multiple tomcat instances
> on a machine, and in order for me to ensure that they can talk to all
> databases we run (test environments) I want to copy all DB drivers into
> each instance.
>
> So basically I have a defined type for my tomcat instance, which does the
> installation of the tomcat binaries and configured the necessary files. Per
> instance I need to copy X files into the lib directory.
> I wanted to do this with another defined type, so I could "loop"
through
> an array of DB-drivers. However, because both instances would require the
> same files, I am running into the "duplicate declaration" error.
>
> Is there any way to resolve this issue?
> Thanks
>