Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to get puppet going for a couple of VMs, my intention is to install jdk6 and tomcat 6 using puppet but i cannot use yum as the machines are not connected to the internet, if it was a simple one machine solution then i could just use the manual installs but i need to automate this and need to build and destroy VMs with the same config.

I ended up using someone's script for jdk, it is a very dirty module and it contains all the RPMs from the bin file from oracle. I put them in the files folder on the module and copy them over from puppet master. Then run the packages individually. the problem is that puppet runs them in no specific order. So i have to wait until 6-7 times when this is attempted to get the packages installed but then last exec command doesnt get executed.

I need to figure out a better way of doing it. A Local or network yum repository is not an option so i need to use the RPM in the same way but i cannot figure out the chaining of packages, i tried using chaining and then nothing gets installed.

Any guidance will be great as i need to write this for tomcat and servicemix

me package is below (very crude code)

# Class: jdk6
#
# This module manages jdk6
#
# Parameters: none
#
# Actions:
#
# Requires: see Modulefile
#
# Sample Usage:
#
class jdk6 {

  file {'/tmp/':
    ensure  => 'directory',
    source  => 'puppet:///modules/jdk6/',
    recurse => 'remote',
    owner   => 'root',
    group   => 'root',
    mode    => '0755',
  }

  file { '/etc/profile.d/set_java_home.sh':
    ensure => present,
    content => 'export JAVA_HOME=/usr/java/jdk1.6.0_37/jre/bin/java'
  }

  package { "jdk": 
      provider => rpm, 
      ensure => installed, 
      source => "/tmp/jdk-6u37-linux-i586.rpm" 
    }

  package { "java_commons": 
        provider => rpm, 
        ensure => installed, 
        source => "/tmp/sun-javadb-common-10.6.2-1.1.i386.rpm" 
      }

  package { "java_db_core": 
        provider => rpm, 
        ensure => installed, 
        source => "/tmp/sun-javadb-core-10.6.2-1.1.i386.rpm" 
      }

  package { "java_client": 
      provider => rpm, 
      ensure => installed, 
      source => "/tmp/sun-javadb-client-10.6.2-1.1.i386.rpm" 
    }

  package { "java_demo": 
        provider => rpm, 
        ensure => installed, 
        source => "/tmp/sun-javadb-demo-10.6.2-1.1.i386.rpm" 
      }
  package { "java_db_demo": 
        provider => rpm, 
        ensure => installed, 
        source => "/tmp/sun-javadb-demo-10.6.2-1.1.i386.rpm" 
      }
  package { "java_dbdocs": 
        provider => rpm, 
        ensure => installed, 
        source => "/tmp/sun-javadb-docs-10.6.2-1.1.i386.rpm" 
      }
  package { "java_docs": 
        provider => rpm, 
        ensure => installed, 
        source => "/tmp/sun-javadb-javadoc-10.6.2-1.1.i386.rpm" 
      }

  exec { "alternatives –config java \
          && alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_37/jre/bin/java 20000 \
          && alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_37/jre/bin/javaws 20000 \
          && alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_37/bin/javac 20000 \
          && alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_37/bin/jar 20000 \
          && alternatives --set java /usr/java/jdk1.6.0_37/jre/bin/java \
          && alternatives --set javaws /usr/java/jdk1.6.0_37/jre/bin/javaws \
          && alternatives --set javac /usr/java/jdk1.6.0_37/bin/javac \
          && alternatives --set jar /usr/java/jdk1.6.0_37/bin/jar \
          && export JAVA_HOME=/usr/java/jdk1.6.0_37/jre/bin/java":
    cwd     => "/tmp",
    path    => ["/usr/bin", "/usr/sbin"]
    require
  }

# this is commented as it was not installing any packages then,  
# Package['java_docs'] -> Package['java_dbdocs'] -> Package['java_db_demo'] -> Package['java_demo'] -> Package['java_client'] -> Package['java_db_core'] -> Package['java_commons'] -> Package['jdk'] 

}
share|improve this question

1 Answer 1

Where there is interdependency you can use 'require'.

package  {
           "mysql-python":
           ensure => installed,
           provider => pip,
           require => Package["libmysqlclient-dev"];
         }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.