On 2014-07-18 08:57, OS wrote:
Hello all,I am newbie to puppet and sorry if it is a silly question. What is wrong with my manifest? define webapp ($domain,$port){ file { "/tmp/${name}": ------------> This is working and creating the files as /tmp/test , /tmp/test1 etc content => "Server:${port}", } notify { $domain: } } $websites = ['test','test1','test2'] webapp { $websites : domain => $websites, ---------> Here, how can iterate websites array? It gives error as duplicate definition. port => 80, }
Do you want to have each of the websites test1 through test3 to be running on each of the domains test1 through test3, or do you want to have each website running on its own domain?
In the former case, work with the array of domains with webapp to create unique resources. E.g by using something like
https://github.com/DavidS/puppet-common/blob/master/plugins/puppet/parser/functions/prefix_with.rb
In the latter case, remove the $domain argument or default it to $name and do not pass wrong data to your define.
Other possibilities include custom hiera lookups, and passing domain data as a hash and indexing by $name.
Regards, D. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/53CCB42B.4070302%40dasz.at. For more options, visit https://groups.google.com/d/optout.
