[Puppet Users] managing java with puppet (RH)

2012-11-20 Thread Arnau Bria
Hi all,

In my systems (SL 6.3, RH like) I'm installing Oracle's Java. 
I'm managing the package and several links under /etc/alternatives
with puppet, but for configuring it, all the 'official' docs recommends
'alternatives'. I've been looking for some module which already
deals with it, but I've not found any... anyone knows any module with
deals with alternatives?


TIA,
Arnau

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] managing java with puppet (RH)

2012-11-20 Thread Johan De Wit

On 11/20/2012 01:05 PM, Arnau Bria wrote:

Hi all,

In my systems (SL 6.3, RH like) I'm installing Oracle's Java.
I'm managing the package and several links under /etc/alternatives
with puppet, but for configuring it, all the 'official' docs recommends
'alternatives'. I've been looking for some module which already
deals with it, but I've not found any... anyone knows any module with
deals with alternatives?


TIA,
Arnau


Hi,

I' ve attached my java module.

We needed to install multiple java versions on the same hosts, so, i 
repackaged them to make that possible. That's why i use the alternatives 
to set a default system wide java version.   I also added a spec file as 
example.


This version is made to run on sles11spX.  I'm now making the deb 
packages for the custom java version.


I hope this will put you on the right track for a possible solution.  
Any comments are welcome.


Grts

johan




--
Johan De Wit

Open Source Consultant
Red Hat Certified Engineer(805008667232363)
Puppet Certified Professional 2013 (PCP006)
_

Open-Future   Phone   +32 (0)2/255 70 70
Zavelstraat 72Fax +32 (0)2/255 70 71
3071 KORTENBERG   Mobile  +32 (0)474/42 40 73
BELGIUM   http://www.open-future.be
_

--
You received this message because you are subscribed to the Google Groups Puppet 
Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

class java {

}
# Define: install_java
#
# This definition installs the vrt repacked java versions.
# Multiple versions can now be installed together on the
# the same host.  Also the 64bit and 32bit can coexist on the
# same host
#
# [version]
#   Which java version to install
#   Possible values : 6 or 7
#   Default : 6
#
# [arch]
#  Which version to install, 64 or 32 bit
#  Possible values : x64, the rest installs the 32bit version
#  Default : x64
#
# [jdk]
#   Wether to install the jdk or the jre
#   Possible values : True, False, Yes, No, Y, N, 0, 1
#   Default :False
#
# [register]
#   Wether to register the  jdk or the jre,  so the installed version
#   can be used as /usr/bin/java
#   Possible values : True, False, Yes, No, Y, N, 0, 1
#   Default : true
#
# [prio]
#   Piority of the  java version.  The java version with the highest prio
#   will be linked to  /usr/bin/java
#
define java::install_java ( version ='6', arch='x64', jdk=false, register=true, 
prio='1' ) {

# check version,
case $version {
'6': {
$my_version = '1.6.0_33'
}
'7': {
$my_version = '1.7.0_05'
}
default: {
notify { 'unsupported java version selected - only 
6u33, 7u5 are supported': }
}
}

case $arch {
'x64': {
$my_arch  = ''
$my_parch = 'x86_64'
}
default: {
$my_arch  = '-32bit'
$my_parch = 'i586'
}
}
case $jdk {
true,'yes','1','Y','y': {
$my_jdk = 'jdk'
}
default: {
$my_jdk = 'jre'
}
}

package { unixODBC${my_arch}:
ensure = present,
}

package { ${my_jdk}${my_arch}-${my_version}-repack:
ensure  = present,
require = Package[ unixODBC${my_arch} ]
}

case $register {
true,'yes','1','Y','y': {
java::register_java { 
${my_jdk}${my_arch}-${my_version}-repack:
order   = $prio,
path= 
/opt/java/${my_parch}/${my_jdk}${my_version}/,
require = Package[ 
${my_jdk}${my_arch}-${my_version}-repack ],
}
}
}
}
define java::register_java ( order='1' , path ) {

$my_prio = $order * 2
$reg_command = /usr/sbin/update-alternatives --install \
/usr/bin/java java ${path}/bin/java $my_prio \
--slave /usr/bin/keytool keytool $path/bin/keytool \
--slave /usr/bin/orbd orbd ${path}/bin/orbd \
--slave /usr/bin/pack200 pack200 ${path}/bin/pack200 \
--slave /usr/bin/policytool policytool 
${path}/bin/policytool \
--slave /usr/bin/rmid rmid ${path}/bin/rmid \
--slave /usr/bin/rmiregistry rmiregistry