Ask Your Question
0

error in multiple file creation

asked 2014-11-11 06:00:16 -0500

Chutki gravatar image

Hi,

I have written below code to create multiple file under /etc/dummy/manifests

class dummy::mulfil{

$filename = ["aaa","bbb","ccc"]

file {$filename:
ensure => 'file',
path => "/etc/dummy/manifests/${filename}"
}
}

need o/p like below

/etc/dummy/manifests/aaa
/etc/dummy/manifests/bbb
/etc/dummy/manifests/ccc

but I get below error

Failed to apply catalog: Cannot alias File[bbb] to ["/etc/dummy/manifestss/aaabbbccc"] at /etc/dummy/manifests/mulfil.pp:13; resource ["File", "/etc/dummy/manifests/aaabbbccc"] already declared at /etc/dummy/manifests/mulfil.pp:13

Also why its creating file name together "/etc/dummy/manifestss/aaabbbccc"

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-11-11 08:53:30 -0500

Future Parser has an iterator now

https://docs.puppetlabs.com/puppet/3/...

$mustseemovies = ['interstellar','hobbit','hunger games']
each($mustseemovies) |$movie| { notice "Go see ${movie} Now! " }
edit flag offensive delete link more

Comments

I am getting below error when i try to compile your code "Could not match |$movie| at /etc/dummy/manifests/movie.pp:4 on node gilda.homedepot.com" below is code class dummy::movie { $mustseemovies = ['interstellar','hobbit','hunger games'] each($mustseemovies) |$movie| { notice "Go see ${movie}"}

Chutki gravatar imageChutki ( 2014-11-12 00:49:42 -0500 )edit

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-11-11 06:00:16 -0500

Seen: 222 times

Last updated: Nov 11 '14