Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add jdk puppet modules

  • Loading branch information...
commit 3a60a485cd2d250f9cc9ee87e92592651df13554 0 parents
Edwin Biemond authored
Showing with 118 additions and 0 deletions.
  1. +19 −0 README
  2. +19 −0 modules/jdk7/README
  3. +80 −0 modules/jdk7/manifests/init.pp
19 README
@@ -0,0 +1,19 @@
+# java jdk7 JAVASE 7 puppet module
+# installs jdk on linux based systems and window with 64 or 32 bits
+# just add the jdk 7 files like jdk-7u7-linux-x64.rpm , jdk-7u7-windows-i586.exe or
+# jdk-7u7-windows-x64.exe downloaded from Oracle website to the files folder of jdk7
+# modules
+#
+# 2 parameters
+# version like 7u7 , 7u8 etc
+# x64 true or false
+#
+# in site.pp add
+# node 'xxxx' {
+#
+# class {'jdk7':
+# version => "7u7",
+# x64 => "true",
+# }
+# }
+
19 modules/jdk7/README
@@ -0,0 +1,19 @@
+# java jdk7 JAVASE 7 puppet module
+# installs jdk on linux based systems and window with 64 or 32 bits
+# just add the jdk 7 files like jdk-7u7-linux-x64.rpm , jdk-7u7-windows-i586.exe or
+# jdk-7u7-windows-x64.exe downloaded from Oracle website to the files folder of jdk7
+# modules
+#
+# 2 parameters
+# version like 7u7 , 7u8 etc
+# x64 true or false
+#
+# in site.pp add
+# node 'xxxx' {
+#
+# class {'jdk7':
+# version => "7u7",
+# x64 => "true",
+# }
+# }
+
80 modules/jdk7/manifests/init.pp
@@ -0,0 +1,80 @@
+# = Class: jdk7
+#
+# This class installs oracle jdk7
+#
+class jdk7 ( $version = undef , $x64 = "true" ) {
+
+
+ case $operatingsystem {
+ centos, redhat, OracleLinux, ubuntu, debian: {
+ $installVersion = "linux"
+ $installExtension = "rpm"
+ $exeBin = "/bin/rpm -Uvh "
+ $exeBinAfter = undef
+ $path = "/root/"
+ $check = "/usr/java/"
+ $checkAfter = "/bin/javac"
+ $user = "root"
+ $group = "root"
+ }
+ windows: {
+ $installVersion = "windows"
+ $installExtension = "exe"
+ $exeBin = undef
+ $exeBinAfter = " /s ADDLOCAL=\"ToolsFeature\""
+ $path = "c:\\temp\\"
+ $check = "c:\\Program Files\\Java\\"
+ $checkAfter = "\\bin\\javac"
+ $user = "Administrator"
+ $group = "Administrators"
+ }
+ default: {
+ fail("Unrecognized operating system")
+ }
+ }
+
+ if $x64 == "true" {
+ $type = 'x64'
+ } else {
+ $type = 'i586'
+ }
+
+ if $version == undef {
+ $jdkVersion = "7u7"
+ } else {
+ $jdkVersion = $version
+ }
+
+
+ if $jdkVersion == "7u7" {
+ $jdkfile = "jdk-7u7-${installVersion}-${type}.${installExtension}"
+ $fullVersion = "jdk1.7.0_07"
+ } elsif $jdkVersion == "7u8" {
+ $jdkfile = "jdk-7u8-${installVersion}-${type}.${installExtension}"
+ $fullVersion = "jdk1.7.0_08"
+ } else {
+ fail("Unrecognized jdk version")
+ }
+
+ file {"jdk_file":
+ path => "${path}${jdkfile}",
+ ensure => present,
+ source => "puppet:///modules/jdk7/${jdkfile}",
+ owner => "${user}",
+ group => "${group}",
+ mode => 0770,
+ }
+
+ exec {"jdk_install":
+ cwd => "${path}",
+ command => "${exeBin}${path}${jdkfile}${exeBinAfter}",
+ require => File["jdk_file"],
+ creates => "${check}${fullVersion}${checkAfter}",
+ }
+
+ notify {"Operating system ${operatingsystem}":}
+ notify {"jdk file ${jdkfile} type ${type}":}
+ notify {"exec command ${exeBin}${path}${jdkfile}$exeBinAfter":}
+ notify {"create command ${check}${fullVersion}${checkAfter}":}
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.