On Friday, August 9, 2013 9:06:42 AM UTC-5, Matthijs Suringa wrote:
>
> Hi,
>
> I'm, still relatively new to Puppet, so there might be something I am
> overlooking.
> Anyway, my situation is that I can install 1 or multiple tomcat instances
> on a machine, and in order for me to ensure that they can talk to all
> databases we run (test environments) I want to copy all DB drivers into
> each instance.
>
> So basically I have a defined type for my tomcat instance, which does the
> installation of the tomcat binaries and configured the necessary files. Per
> instance I need to copy X files into the lib directory.
> I wanted to do this with another defined type, so I could "loop" through
> an array of DB-drivers. However, because both instances would require the
> same files, I am running into the "duplicate declaration" error.
>
> Is there any way to resolve this issue?
>
>
I think you are saying that for each Tomcat instance you want to ensure the
same files present in the same directory (rather than in distinct,
instance-specific directories). The key problem with your approach to that
is you are trying to manage the driver files as if they belong to
individual instances, whereas they actually belong to Tomcat overall.
The available solutions fall into two categories:
1. Give each Tomcat instance its own, separate copies of the files.
2. Factor the affected file resources out of your Tomcat instance
definition, and instead manage them in one central place for all
instances. The most likely way to do this would be to put them into a
class that the instance definition declares (which works because Puppet
classes are idempotent).
Example:
class tomcat::db_drivers {
include 'tomcat'
file { "$tomcat_root/lib/mysql.jar":
ensure => 'present',
source => 'puppet://modules/tomcat/mysql.jar'
}
...
}
define tomcat::instance(...) {
include 'tomcat'
include 'tomcat::db_drivers'
# instance-specific resources ...
}
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.
For more options, visit https://groups.google.com/groups/opt_out.