Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Modulefile

This file was deleted.

15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ puppet-java7

Puppet module for managing Oracle JDK 7 on Debian or Ubuntu.

Note that this module does not work out-of-the-box. You need to manually download the i586 and x64 JDK tarballs from Oracle here:
Note that this module does not work out-of-the-box. You need to manually download the i586 or x64 JDK tarballs from Oracle here:
[http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html).
Both *jdk-7u5-linux-i586.tar.gz* and *jdk-7u5-linux-x64.tar.gz* need to be put in the *files* directory of this module.
By default, either *jdk-7u5-linux-i586.tar.gz* or *jdk-7u5-linux-x64.tar.gz* (depending on your architecture) need to be put in the *files* directory of this module.

You can also configure the class with the name of the tarball, the java version to install, and the path where the JDK tarball can be found.
For example, the following configuration is used in Debian Wheeze to install the 1.7.0_21 version of the X64 JDK:

class some_class {
class { 'java7':
version => '1.7.0_21',
tarball_name_prefix => 'jdk-7u21-linux',
jdk_path => '/var/run/puppet/java/'
}
}
30 changes: 21 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
class java7 {
$version = "1.7.0_05"
class java7 ($version = "1.7.0_05", $tarball_name_prefix = "jdk-7u5-linux", $jdk_path = "") {

$tarball = $architecture ? {
"amd64" => "jdk-7u5-linux-x64.tar.gz",
default => "jdk-7u5-linux-i586.tar.gz",
"amd64" => "${tarball_name_prefix}-x64.tar.gz",
default => "${tarball_name_prefix}-i586.tar.gz",
}

package { "java-common":
ensure => latest,
}

file { "java-tarball":
ensure => file,
path => "/tmp/$tarball",
source => "puppet:///modules/java7/${tarball}",
if jdk_path == "" {
file { "java-tarball":
ensure => file,
path => "/tmp/$tarball",
source => "puppet:///modules/java7/${tarball}",
}
}
else {
exec { "cp-java-tarball-to-tmp":
command => "cp $jdk_path/$tarball /tmp/$tarball",
unless => "[ -f /tmp/$tarball]"
} ->
file { "java-tarball":
ensure => file,
path => "/tmp/$tarball",
}
}

exec { "extract-java-tarball":
Expand Down Expand Up @@ -66,4 +78,4 @@
refreshonly => true,
require => File["/usr/lib/jvm/java-7-oracle"],
}
}
}