Merge pull request #223 from bastelfreak/puppet4
replace validate_* calls with datatypes & minor fixes
This commit is contained in:
@@ -22,29 +22,30 @@ The java module can automatically install Java jdk or jre on a wide variety of s
|
||||
## Setup
|
||||
|
||||
### Beginning with the java module
|
||||
|
||||
To install the correct Java package on your system, include the `java` class: `include java`.
|
||||
|
||||
## Usage
|
||||
|
||||
The java module installs the correct jdk or jre package on a wide variety of systems. By default, the module installs the jdk package, but you can set different installation parameters as needed. For example, to install jre instead of jdk, you would set the distribution parameter:
|
||||
|
||||
~~~
|
||||
```puppet
|
||||
class { 'java':
|
||||
distribution => 'jre',
|
||||
}
|
||||
~~~
|
||||
```
|
||||
|
||||
To install the latest patch version of Java 8 on CentOS
|
||||
|
||||
~~~
|
||||
```puppet
|
||||
class { 'java' :
|
||||
package => 'java-1.8.0-openjdk-devel',
|
||||
}
|
||||
~~~
|
||||
```
|
||||
|
||||
The defined type `java::oracle` installs one or more versions of Oracle Java SE. `java::oracle` depends on [puppet/archive](https://github.com/voxpupuli/puppet-archive). By using `java::oracle` you agree to Oracle's licensing terms for Java SE.
|
||||
|
||||
~~~
|
||||
```puppet
|
||||
java::oracle { 'jdk6' :
|
||||
ensure => 'present',
|
||||
version => '6',
|
||||
@@ -56,18 +57,18 @@ java::oracle { 'jdk8' :
|
||||
version => '8',
|
||||
java_se => 'jdk',
|
||||
}
|
||||
~~~
|
||||
```
|
||||
|
||||
To install a specific release of a Java version, e.g. 8u101-b13, provide both parameters `version_major` and `version_minor` as follows:
|
||||
|
||||
~~~
|
||||
```puppet
|
||||
java::oracle { 'jdk8' :
|
||||
ensure => 'present',
|
||||
version_major => '8u101',
|
||||
version_minor => 'b13',
|
||||
java_se => 'jdk',
|
||||
}
|
||||
~~~
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
||||
@@ -85,25 +86,31 @@ java::oracle { 'jdk8' :
|
||||
|
||||
|
||||
#### Parameters
|
||||
|
||||
The following parameters are available in `java`:
|
||||
|
||||
##### `distribution`
|
||||
|
||||
Specifies the Java distribution to install.
|
||||
Valid options: 'jdk', 'jre', or, where the platform supports alternative packages, 'sun-jdk', 'sun-jre', 'oracle-jdk', 'oracle-jre'. Default: 'jdk'.
|
||||
|
||||
##### `java_alternative`
|
||||
|
||||
Specifies the name of the Java alternative to use. If you set this parameter, *you must also set the `java_alternative_path`.*
|
||||
Valid options: Run command `update-java-alternatives -l` for a list of available choices. Default: OS and distribution dependent defaults on *deb systems, undef on others.
|
||||
|
||||
##### `java_alternative_path`
|
||||
|
||||
*Required when `java_alternative` is specified.* Defines the path to the `java` command.
|
||||
Valid option: String. Default: OS and distribution dependent defaults on *deb systems, undef on others.
|
||||
|
||||
##### `package`
|
||||
|
||||
Specifies the name of the Java package. This is configurable in case you want to install a non-standard Java package. If not set, the module installs the appropriate package for the `distribution` parameter and target platform. If you set `package`, the `distribution` parameter does nothing.
|
||||
Valid option: String. Default: undef.
|
||||
|
||||
##### `version`
|
||||
|
||||
Sets the version of Java to install, if you want to ensure a particular version.
|
||||
Valid options: 'present', 'installed', 'latest', or a string matching `/^[.+_0-9a-zA-Z:-]+$/`. Default: 'present'.
|
||||
|
||||
@@ -119,24 +126,31 @@ The following parameters are available in `java::oracle`:
|
||||
Version of Java Standard Edition (SE) to install. 6, 7 or 8.
|
||||
|
||||
##### `version_major`
|
||||
|
||||
Major version of the Java Standard Edition (SE) to install. Must be used together with `version_minor`. For example, '8u101'.
|
||||
|
||||
##### `version_minor`
|
||||
|
||||
Minor version (or build version) of the Java Standard Edition (SE) to install. Must be used together with `version_major`. For example, 'b13'.
|
||||
|
||||
##### `java_se`
|
||||
|
||||
Type of Java SE to install, jdk or jre.
|
||||
|
||||
##### `ensure`
|
||||
|
||||
Install or remove the package.
|
||||
|
||||
##### `oracle_url`
|
||||
|
||||
Official Oracle URL to download the binaries from.
|
||||
|
||||
##### `proxy_server`
|
||||
|
||||
Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive)
|
||||
|
||||
##### `proxy_type`
|
||||
|
||||
Proxy server type (none|http|https|ftp). (passed to archive)
|
||||
|
||||
### Facts
|
||||
@@ -178,6 +192,7 @@ Sun Java is supported on:
|
||||
* Debian 6
|
||||
|
||||
Oracle Java is supported on:
|
||||
|
||||
* CentOS 6
|
||||
|
||||
### Known issues
|
||||
|
||||
@@ -46,22 +46,16 @@
|
||||
# Sample Usage:
|
||||
#
|
||||
class java(
|
||||
$distribution = 'jdk',
|
||||
$version = 'present',
|
||||
$package = undef,
|
||||
$package_options = undef,
|
||||
$java_alternative = undef,
|
||||
$java_alternative_path = undef,
|
||||
$java_home = undef
|
||||
String $distribution = 'jdk',
|
||||
Pattern[/present|installed|latest|^[.+_0-9a-zA-Z:~-]+$/] $version = 'present',
|
||||
Optional[String] $package = undef,
|
||||
Optional[Array] $package_options = undef,
|
||||
Optional[String] $java_alternative = undef,
|
||||
Optional[String] $java_alternative_path = undef,
|
||||
Optional[String] $java_home = undef
|
||||
) {
|
||||
include java::params
|
||||
|
||||
validate_re($version, 'present|installed|latest|^[.+_0-9a-zA-Z:~-]+$')
|
||||
|
||||
if $package_options != undef {
|
||||
validate_array($package_options)
|
||||
}
|
||||
|
||||
if has_key($java::params::java, $distribution) {
|
||||
$default_package_name = $java::params::java[$distribution]['package']
|
||||
$default_alternative = $java::params::java[$distribution]['alternative']
|
||||
|
||||
@@ -89,7 +89,13 @@
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0 < 5.0.0"},
|
||||
{"name":"puppet/archive","version_requirement":">= 1.1.0 < 2.0.0"}
|
||||
{
|
||||
"name":"puppetlabs/stdlib",
|
||||
"version_requirement": ">= 4.13.1 < 5.0.0"
|
||||
},
|
||||
{
|
||||
"name":"puppet/archive",
|
||||
"version_requirement": ">= 1.1.0 < 2.0.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user