thanks for reply, first let me again describe my problem in detail. I have two database server db01 and db02, on the database server (db01) i have to install and configure postgresql and pg_statinfo module and on database server(db02) i have to install and configure only postgresql.
I created postgresql module to install and configure postgresql and pg_statsinfo module for pg_statsinfo. Here, "postgresql.conf" file contains the configuration for both postgresql and pg_statsinfo.(This is the common file which is to be edited, i use template to make changes), for the pg_statsinfo module i have to add the addition contents to file plus change some in between contents. I am not able to change postgresql.conf file twice in postgresql module and then pg_statsinfo module in case of db01, it give duplication declaration of file resources. If i change the contents of postgresql.conf file in postgresql module then in case of db02 the postgresql not working because some addition parameters of pg_statsinfo in postgresql.conf. i hope this help you to understand the scenario, how i maintain the modularity between to modules and change the same file twice for correct working. Thanks in advance. Rahul On Friday, April 12, 2013 6:45:37 PM UTC+5:30, jcbollinger wrote: > > > > On Thursday, April 11, 2013 1:11:16 PM UTC-5, Rahul Khengare wrote: >> >> Hi all, >> I am writing two modules abc and xyz. In both the modules i have to >> change common "test.txt" file,here i use template (.erb) file to changing >> the contents. >> In both abc and xyz the contents of "test.txt" file is different, if i >> declare file resource for "test.txt" file in two different modules it gives >> duplicate declaration of resource error. >> For the correct working of modules abc and xyz, i have to change the >> test.txt file twice. >> How i overcome this situation ? >> > > > You need to frame the problem correctly. A File resource represents a > whole, specific file. What is it even supposed to mean if you specify the > same target file's content differently in different places? Your two > declarations cannot both be satisfied. This sort of internal inconsistency > is one of the reasons for Puppet's prohibition against multiple > declarations of the same resource (though that prohibition applies even > when two or more declarations all specify exactly the same parameters). > > There are at least two different things you could reasonably mean: > > > 1. Most likely, you mean that you want to separately describe two or > more different parts of the same file. In that case you are incorrect to > model the parts as File resources, because they are not whole files. > There > are multiple ways to handle this, but a good one would be via the Concat > module, which you can find on the module forge. It will allow you to > model > individual pieces of a file, and to specify how they are to be assembled > to > form the whole. > 2. You could mean that you want to declare separate files whose > contents are based on the same template. In that case it is correct to > use > separate File resources, but you must be declaring them wrongly. Each one > must have a unique title and a unique absolute filename (path property); > if > not specified explicitly, the absolute filename is the same as the title. > There is no inherent need for the resource title or target file name to > have any particular relationship with the template file name (though you > will make it easier on yourself if you choose something that helps you > associate them). > > > Good luck, > > John > > -- 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
