Hi everyone,
Just getting into Puppet, so please bear with me :D
I'm setting up a java module to keep an eye on the java installation on our
RHEL machines. Quick background, RHEL ships openjdk, we need to use Oracle
instead. I've gone ahead and put the latest oracle java6 RPM, *
jre-6u45-linux-amd64*, on one of our puppet-managed boxes.
Like many distributions, RHEL has a utility to manage multiple
installations of java. I've already set the default version of java to the
latest oracle, so java -version yields java version "1.6.0_45".
Here is a dead simple java module to verify installation
class java {
package { 'jre-6u45-linux-amd64':
ensure => installed,
}
}
This works great, but suppose I change the default by hand, just to gauge
puppet's reaction.
sudo alternatives --set java /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
java -version
java version "1.6.0_24"
Now, when I run sudo puppet agent --test, this is what comes out
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install
jre-6u45-linux-amd64' returned 1: Error: Nothing to do
Error: /Stage[main]/Java/Package[jre-6u45-linux-amd64]/ensure: change from
absent to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install
jre-6u45-linux-amd64' returned 1: Error: Nothing to do
This is actually not what I expected, since* jre-6u45-linux-amd* is
installed, just not set to be the default. Puppet seems to think the
package is absent however, any thoughts on the reaction from puppet?
Ultimately what I'd like to achieve is a smooth check / ensure that java is
installed and at the correct version, but since this is an RPM from outside
yum I'm running into a little trouble. First off, I'd expect the above
module to work, even when the correct version isn't configured. The next
step in my mind would be to coax puppet into running sudo alternatives
--set java /usr/java/jre1.6.0_45/bin/java if the installation check
succeeds, but the default isn't correctly set.
I grabbed a *java_version* fact from another groups
discussion<https://groups.google.com/forum/#!topic/puppet-users/W67dvqS-GdU>,
and naively the module code would look something like this
# if version check in package resource succeeds ..
if($java_version != '1.6.0_45')
# run sudo alternatives --set java /usr/java/jre1.6.0_45/bin/java
but I already know enough puppet to know that's not the way to do it :) Can
you good people help a newb glue this one together?
thanks,
-nathan
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.