How to generate files based on array contents?
Hi,
I'd like to be able to create files based on the contents of an array. Here is what I have tried:
class make_files (
$servers = ['server-1','server-2','server-3'],
) {
file { $servers :
path => '/tmp',
content => $servers,
}
}
... but when I execute this like so ...
# puppet apply --modulepath=/root/modules -e 'include make_files'
... I get this output:
Notice: Compiled catalog for host-001 in environment production in 0.13 seconds
Error: Cannot alias File[server-2] to ["/tmp"] at /root/modules/make_files/manifests/init.pp:9; resource ["File", "/tmp"] already declared at /root/modules/make_files/manifests/init.pp:9
I was hoping to have three files ...
# ls /tmp/server-?
/tmp/server-1 /tmp/server-2 /tmp/server-3
# cat /tmp/server-?
server-1
server-2
server-3
Any help is appreciated thanks!