Defined Type: tomcat::service

Defined in:
manifests/service.pp

Overview

Define Resource: tomcat::service

Full description of define tomcat::service here.

Parameters

Using titles like ‘server:service’ are split off automaticly in parameters ‘server’ and ‘service’. That defines the service ‘service’ in section server of the configuration file ‘server.xml’ for tomcat server instance ‘server’.

server

Name of tomcat server instance to add the connector, automaticly taken from ‘title’ then using ‘title’ like ‘server:service:engine’ otherwise undef.

service

Name of tomcat engine to add the service ‘service’, automaticly taken from ‘title’ then using ‘title’ like ‘server:service:engine’ otherwise undef.

connectors

Hash of connectors and their attributes. If sets and non equal to empty hash {}, the default is used:

engine

Hash of the engine and their attributes.

Authors

Author Lennart Betz <lennart.betz@netways.de>

Parameters:

  • connectors (Any) (defaults to: undef)
  • engine (Any) (defaults to: undef)
  • server (Any) (defaults to: regsubst($name, '^([^:]+):[^:]+$', '\1') ? { $name => undef, default => regsubst($name, '^([^:]+):[^:]+$', '\1'))
  • service (Any) (defaults to: regsubst($name, '^[^:]+:([^:]+)$', '\1') ? { $name => undef, default => regsubst($name, '^[^:]+:([^:]+)$', '\1'))


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
# File 'manifests/service.pp', line 29

define tomcat::service(
  $connectors = undef,
  $engine     = undef,
  $server     = regsubst($name, '^([^:]+):[^:]+$', '\1') ? {
    $name   => undef,
    default => regsubst($name, '^([^:]+):[^:]+$', '\1'), },
  $service = regsubst($name, '^[^:]+:([^:]+)$', '\1') ? {
    $name   => undef,
    default => regsubst($name, '^[^:]+:([^:]+)$', '\1'), },
) {

  validate_string($server)
  validate_string($service)

  $version = $tomcat::version

  if $engine {
    validate_hash($engine)
    $_engine = $engine }
  else {
    $_engine = $tomcat::engine
  }
  if $connectors {
    validate_hash($connectors)
    $_connectors = $connectors }
  else {
    $_connectors = $tomcat::connectors
  }

  if $tomcat::standalone {
    $confdir = $params::conf[$version]['confdir'] }
  else {
    $confdir = "${tomcat::basedir}/${server}/conf"
  }

  concat::fragment { "server.xml-${name}-header":
    target  => "${confdir}/server.xml",
    content => "\n   <Service name='${service}'>\n\n",
    order   => "50_${service}_00",
  }

  concat::fragment { "server.xml-${name}-footer":
    target  => "${confdir}/server.xml",
    content => "\n   </Service>\n",
    order   => "50_${service}_99",
  }

  create_resources(tomcat::connector,
    hash(zip(prefix(keys($_connectors), "${server}:${service}:"), values($_connectors))))

  create_resources(tomcat::engine,
    hash(zip(prefix(keys($_engine), "${server}:${service}:"), values($_engine))))

}