Ask Your Question

Duplicate resources issue

asked 2014-01-04 10:24:41 -0600

Cvieri gravatar image


I have got a module that manages deployment of *.war file and installs needed java version. In init.pp I call parameterized class tomcat and pass to it needed java path

class { tomcat: java_path => $java_path}

It is fine for 1 such class per host, but what if I call similar module, that will call tomcat class too. Certainly it will fail. What can you recommend, any best practice?

PS: it is very important to pass java_version, cause it can vary.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-01-05 14:27:26 -0600

Gary Steven gravatar image

Forgive me if I am mistaken but it sounds like you have 2-3 total modules here.

Does your Tomcat module need to be separate from your deployment module?
Does your Java installation need to be part of the Tomcat module?

I would recommend moving Java to its own module as there could be occasions where you want a JRE / JDK but do not want Tomcat.

Sample Java init.pp

class java (
  $ensure  = 'present',
  $type    = 'jdk',
  $version = '1.6.0_45' ) {

  case $type {
    'jdk','jre': {
    default: {
      fail ( "Invalid Java type: ${type}, Valid options are 'jdk' or 'jre'": }

  class java::install {
    ensure  => $ensure ...
edit flag offensive delete link more

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


Asked: 2014-01-04 10:24:41 -0600

Seen: 75 times

Last updated: Jan 05 '14