Hi John, Thank you for your response.
Well what I am trying to do is to create A file with data from Hiera. I am using this module: https://github.com/GRIF-IRFU/puppet-omd plus the one I have just developed to add new sites, hosts and commands. However, I have been asked to create Business Intelligence rules which takes some IP addresses and the same number of services and group them together. Let's say, I've got 10 nodes with 10 services each. In the bi.mk file I have to declare a rule which looks as follows: aggregation_rules["customer"] = { 'aggregation': 'worst!1!2', 'comment': u'All the services associated with the customer', 'nodes': [(u'10.0.0.1', u'service1_ssl'), (u'10.0.0.2', u'service1_101'), (u'10.0.0.3', u'service1_103')], 'params': [], 'title': u'Customer Services' } So therefore, what I am trying to do, is that I've got a template which does this for me, and I have specified A CLASS instead of define as you've said I was getting an error saying that the couldn't associate alias because file it is already declared (because of its path). So, the class i've created makes a file from an erb template. However, when I am running Puppet I just get printed in the file the name of the class instead of the data. I was thinking about using concat but I am a Puppet beginner and I am not really sure how to go about incorporating the erb logic in the concat function. Thank you, Kind regards, Sergiu On Thursday, 8 October 2015 15:37:25 UTC+1, jcbollinger wrote: > > > > On Thursday, October 8, 2015 at 3:38:55 AM UTC-5, Sergiu Cornea wrote: >> >> Hi Martin, >> >> Thank you for your response. >> >> This is the code I have developed: >> >> http://pastebin.com/76SzwhZV >> >> > Are we to assume that the commented-out File declaration in that code is > the one that causes the difficulty? So that the error occurs with the > definition below? > > define omd::omd_create::omd_rules ( > $omd_site = '', > $omd_service = [], > $omd_ip = [], > $h = {}, ) { > > file { $title: > path => '/omd/sites/test/etc/check_mk/multisite.d/wato/bi.mk', > ensure => file, > content => template('omd/bi.mk.erb'), > } > } > > That would be completely believable. Although the definition is not > inherently erroneous, it only accommodates a single instance, because it > declares a file resource with a fixed path, and any second instance will > therefore attempt to declare a duplicate resource. > > It's unclear what you're trying to do here. If you are trying to manage > separate files then of course you need to specify each one's name. If you > are trying to manage a single file with information gleaned from multiple > resources, then then consider looking into the Concat module. On the other > hand, if you are indeed trying to manage a single file, then consider > whether you can instead do it via a single resource -- it appears that your > code could be modified to accommodate that, but it depends to some extent > on how it is used, and what you want to do with it in the future. > > > John > > -- This message and its attachments are private and confidential. If you have received this message in error, please notify the sender and remove it and its attachments from your system. The University of Westminster is a charity and a company limited by guarantee. Registration number: 977818 England. Registered Office: 309 Regent Street, London W1B 2UW. -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4e072c33-a7cf-40c6-9ac3-c21436db4dfe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.