Defined Type: cassandra::jvm_option_set
- Defined in:
- manifests/jvm_option_set.pp
Summary
Set JVM options by controlling particular lines of jvm.options file.Overview
Select the file to be controlled by choosing, jvm, jvm8 or jvm11 and the variant server or clients. Options, properties and advanced runtime options can be defined to have particular values or to be removed from the configuration. Any option not mentioned will not be touched.
For Cassandra 3.x versions, only optsfile = jvm
with
variant = undef
is supported, which will control the
/etc/cassandra/jvm.options
file. Since Cassandra versions
>= 4.0 use distinct option files for server and clients, as well as Java
independent, Java-8 and Java-11, use parameters optsfile
and
variant
to select a particular options file.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'manifests/jvm_option_set.pp', line 26
define cassandra::jvm_option_set (
Enum['jvm', 'jvm8', 'jvm11'] $optsfile = 'jvm',
Optional[Enum['clients', 'server']] $variant = undef,
Array[String] $options = [],
Hash[String,Optional[Scalar]] $properties = {},
Hash[String,Optional[Scalar]] $sizeoptions = {},
Hash[String,Optional[Scalar]] $advancedoptions = {},
) {
$_file = $variant ? {
/^(server|clients)$/ => "${cassandra::config_dir}/${optsfile}-${variant}.options",
default => "${cassandra::config_dir}/${optsfile}.options",
}
$options.each |String $_opt| {
if $_opt =~ /^~/ {
$_value = $_opt[1,-1]
file_line { "${name} remove option ${_value}":
ensure => absent,
path => $_file,
line => "-${_value}",
}
} else {
file_line { "${name} set option ${_opt}":
ensure => present,
path => $_file,
line => "-${_opt}",
}
}
} # $options.each
$sizeoptions.each |String $_prop, Data $_value| {
if $_value =~ Undef {
file_line { "${name} remove size option ${_prop}":
ensure => absent,
path => $_file,
match => "^-${_prop}",
match_for_absence => true,
}
} else {
file_line { "${name} set size option ${_prop}":
ensure => present,
path => $_file,
match => "^-${_prop}",
line => "-${_prop}${_value}",
}
}
} # $sizeoptions.each
$properties.each |String $_prop, Data $_value| {
if $_value =~ Undef {
file_line { "${name} remove property ${_prop}":
ensure => absent,
path => $_file,
match => "^-D${_prop}",
match_for_absence => true,
}
} else {
file_line { "${name} set property ${_prop}":
ensure => present,
path => $_file,
match => "^-D${_prop}",
line => "-D${_prop}=${_value}",
}
}
} # $properties.each
$advancedoptions.each |String $_aopt, Data $_value| {
if $_value =~ Undef {
file_line { "${name} remove advanced runtime option ${_aopt}":
ensure => absent,
path => $_file,
match => "^-XX:[+-]?${_aopt}",
match_for_absence => true,
}
} else {
if $_value =~ Boolean {
$_pre = $_value ? {
true => '+',
default => '-',
}
file_line { "${name} set boolean advanced runtime option ${_aopt}":
ensure => present,
path => $_file,
match => "^-XX:[+-]${_aopt}",
line => "-XX:${_pre}${_aopt}",
}
} else {
file_line { "${name} set advanced runtime option ${_aopt}":
ensure => present,
path => $_file,
match => "^-XX:${_aopt}",
line => "-XX:${_aopt}=${_value}",
}
}
}
}
}
|