Puppet oracle java7 installation.
root@puppet:/etc/puppet/modules# puppet module install puppetlabs-apt
Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations
(at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning')
Notice: Preparing to install into /etc/puppet/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/etc/puppet/modules
└─┬ puppetlabs-apt (v1.8.0)
└── puppetlabs-stdlib (v4.5.1)
root@puppet:/etc/puppet/modules#
root@puppet:/etc/puppet/modules/java# cat manifests/init.pp
class java {
include java::default
}
root@puppet:/etc/puppet/modules/java# cat manifests/default.pp
# From https://gist.github.com/hameno/8219185
class java::default {
class { 'apt': }
# Add ppa
apt::ppa { 'ppa:webupd8team/java':} ->
# Prepare response file
file { "/tmp/oracle-java7-installer.preseed":
source => 'puppet:///modules/java/java.response',
mode => 600,
backup => false,
} ->
# Install java
package { "oracle-java7-installer":
ensure => "installed",
responsefile => '/tmp/oracle-java7-installer.preseed'
} ->
package { "oracle-java7-set-default": ensure => "installed" }
}
root@puppet:/etc/puppet/modules/java# cat files/java.response
# From https://gist.github.com/hameno/8219185
oracle-java7-installer shared/accepted-oracle-license-v1-1 select true
oracle-java7-installer shared/accepted-oracle-license-v1-1 seen true
root@puppet:/etc/puppet/modules/java/manifests# cat init.pp
class java {
include java::default
}
root@puppet:/etc/puppet/manifests# cat site.pp
node default { }
node 'ts' {
include nginx
include ssh
}
node 'ts1' {
include nginx
include ssh
include java
}
root@ts1:~# puppet agent --test
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for ts1
Info: Applying configuration version '1428587206'
Notice: /Stage[main]/Java::Default/File[/tmp/oracle-java7-installer.preseed]/ensure: defined content as '{md5}0ab981127e3d597b2175f9959eb70c3f'
Notice: /Stage[main]/Nginx/Exec[apt-update]/returns: executed successfully
Info: Package[oracle-java7-installer](provider=apt): Preseeding /tmp/oracle-java7-installer.preseed to debconf-set-selections
Notice: /Stage[main]/Java::Default/Package[oracle-java7-installer]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Java::Default/Package[oracle-java7-set-default]/ensure: ensure changed 'purged' to 'present'
Notice: Finished catalog run in 243.44 seconds
root@ts1:~# which java
/usr/bin/java
root@ts1:~# java -version
java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
No comments:
Post a Comment