Added support for Java VM options

This commit is contained in:
Karel Brezina 2013-02-15 17:16:36 +01:00
parent fc5cdd4a0f
commit 7a1557a79f
5 changed files with 75 additions and 4 deletions

View file

@ -231,6 +231,12 @@ Supports a Boolean of true or false, indicating whether or not the module should
The puppetdb configuration directory (defaults to `/etc/puppetdb/conf.d`).
####`java_args`
Java VM options used for overriding default Java VM options specified in PuppetDB package (defaults to `{}`). See [PuppetDB Configuration](http://docs.puppetlabs.com/puppetdb/1.1/configure.html) to get more details about the current defaults.
Example: to set `-Xmx512m -Xms256m` options use `{ '-Xmx' => '512m', '-Xms' => '256m' }`
### puppetdb:server
The `puppetdb::server` class manages the puppetdb server independently of the underlying database that it depends on. It will manage the puppetdb package, service, config files, etc., but will still allow you to manage the database (e.g. postgresql) however you see fit.

View file

@ -0,0 +1,15 @@
module Puppet::Parser::Functions
newfunction(:puppetdb_create_subsetting_resource_hash, :type => :rvalue) do |args|
java_args = args[0]
params = args[1]
resource_hash = {}
java_args.each { |k,v|
item_params = { 'subsetting' => k, 'value' => (v || '') }
item_params.merge!(params)
resource_hash.merge!({ "'#{k}'" => item_params })
}
resource_hash
end
end

View file

@ -75,7 +75,10 @@
# all TCP connections).
# ['confdir'] - The puppetdb configuration directory; defaults to
# `/etc/puppetdb/conf.d`.
#
# ['java_args'] - Java VM options used for overriding default Java VM
# options specified in PuppetDB package.
# (defaults to `{}`).
# e.g. { '-Xmx' => '512m', '-Xms' => '256m' }
# Actions:
# - Creates and manages a puppetdb server and its database server/instance.
#
@ -106,7 +109,8 @@ class puppetdb(
$puppetdb_service = $puppetdb::params::puppetdb_service,
$open_postgres_port = $puppetdb::params::open_postgres_port,
$manage_redhat_firewall = $puppetdb::params::manage_redhat_firewall,
$confdir = $puppetdb::params::confdir
$confdir = $puppetdb::params::confdir,
$java_args = {}
) inherits puppetdb::params {
# Apply necessary suffix if zero is specified.
@ -163,7 +167,8 @@ class puppetdb(
puppetdb_version => $puppetdb_version,
puppetdb_service => $puppetdb_service,
manage_redhat_firewall => $manage_redhat_firewall,
confdir => $confdir
confdir => $confdir,
java_args => $java_args,
}
if ($database == 'postgres') {

View file

@ -78,6 +78,18 @@ class puppetdb::params {
$puppet_confdir = '/etc/puppetlabs/puppet'
$terminus_package = 'pe-puppetdb-terminus'
$embedded_subname = 'file:/opt/puppet/share/puppetdb/db/db;hsqldb.tx=mvcc;sql.syntax_pgs=true'
case $::osfamily {
'RedHat': {
$puppetdb_initconf = '/etc/sysconfig/pe-puppetdb'
}
'Debian': {
$puppetdb_initconf = '/etc/default/pe-puppetdb'
}
default: {
fail("${module_name} supports osfamily's RedHat and Debian. Your osfamily is recognized as ${::osfamily}")
}
}
} else {
$puppetdb_package = 'puppetdb'
$puppetdb_service = 'puppetdb'
@ -86,6 +98,18 @@ class puppetdb::params {
$puppet_confdir = '/etc/puppet'
$terminus_package = 'puppetdb-terminus'
$embedded_subname = 'file:/usr/share/puppetdb/db/db;hsqldb.tx=mvcc;sql.syntax_pgs=true'
case $::osfamily {
'RedHat': {
$puppetdb_initconf = '/etc/sysconfig/puppetdb'
}
'Debian': {
$puppetdb_initconf = '/etc/default/puppetdb'
}
default: {
fail("${module_name} supports osfamily's RedHat and Debian. Your osfamily is recognized as ${::osfamily}")
}
}
}
$puppet_conf = "${puppet_confdir}/puppet.conf"

View file

@ -82,7 +82,10 @@
# all TCP connections).
# ['confdir'] - The puppetdb configuration directory; defaults to
# `/etc/puppetdb/conf.d`.
#
# ['java_args'] - Java VM options used for overriding default Java VM
# options specified in PuppetDB package.
# (defaults to `{}`).
# e.g. { '-Xmx' => '512m', '-Xms' => '256m' }
# Actions:
# - Creates and manages a puppetdb server
#
@ -116,6 +119,7 @@ class puppetdb::server(
$puppetdb_service = $puppetdb::params::puppetdb_service,
$manage_redhat_firewall = $puppetdb::params::manage_redhat_firewall,
$confdir = $puppetdb::params::confdir,
$java_args = {}
) inherits puppetdb::params {
# Apply necessary suffix if zero is specified.
@ -185,6 +189,23 @@ class puppetdb::server(
notify => Service[$puppetdb_service],
}
if !empty($java_args) {
create_resources(
'ini_subsetting',
puppetdb_create_subsetting_resource_hash(
$java_args,
{ ensure => present,
section => '',
key_val_separator => '=',
path => $puppetdb::params::puppetdb_initconf,
setting => 'JAVA_ARGS',
require => Package[$puppetdb_package],
notify => Service[$puppetdb_service],
})
)
}
service { $puppetdb_service:
ensure => running,
enable => true,