Defined Type: tomcat::host

Defined in:
manifests/host.pp

Overview

Define Resource: tomcat::host

Full description of define tomcat::listener here.

Parameters

Using titles like ‘server:service:engine:host’ are split off automaticly in parameters ‘server’, ‘service’, ‘engine’ and ‘host’. That defines a host under ‘engine’ in section ‘service’ 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:host’ otherwise undef

service

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

engine

Name of the engine. automaticly taken from ‘title’ then using ‘title’ like ‘server:service:engine:host’ otherwise undef

host

Name of the host. automaticly taken from ‘title’ then using ‘title’ like ‘server:service:engine:host’ otherwise undef

app_base
auto_deploy
unpack_wars
xml_validation
xml_namespace_aware
realms

Hash of realms defined for this host.

contexts

Hash of contexts defined for this host.

Authors

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

Parameters:

  • app_base (Any) (defaults to: undef)
  • auto_deploy (Any) (defaults to: undef)
  • unpack_wars (Any) (defaults to: undef)
  • xml_validation (Any) (defaults to: undef)
  • xml_namespace_aware (Any) (defaults to: undef)
  • realms (Any) (defaults to: {})
  • contexts (Any) (defaults to: {})
  • 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'))
  • engine (Any) (defaults to: regsubst($name, '^[^:]+:[^:]+:([^:]+):.*$', '\1') ? { $name => undef, default => regsubst($name, '^[^:]+:[^:]+:([^:]+):.*$', '\1'))
  • host (Any) (defaults to: regsubst($name, '^.*:([^:]+)$', '\1') ? { $name => undef, default => regsubst($name, '^.*:([^:]+)$', '\1'))


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

define tomcat::host(
  $app_base            = undef,
  $auto_deploy         = undef,
  $unpack_wars         = undef,
  $xml_validation      = undef,
  $xml_namespace_aware = undef,
  $realms              = {},
  $contexts            = {},
  $server              = regsubst($name, '^([^:]+):.*$', '\1') ? {
    $name   => undef,
    default => regsubst($name, '^([^:]+):.*$', '\1'),
  },
  $service             = regsubst($name, '^[^:]+:([^:]+):.*$', '\1') ? {
    $name   => undef,
    default => regsubst($name, '^[^:]+:([^:]+):.*$', '\1'),
  },
  $engine              = regsubst($name, '^[^:]+:[^:]+:([^:]+):.*$', '\1') ? {
    $name   => undef,
    default => regsubst($name, '^[^:]+:[^:]+:([^:]+):.*$', '\1'),
  },
  $host                = regsubst($name, '^.*:([^:]+)$', '\1') ? {
    $name   => undef,
    default => regsubst($name, '^.*:([^:]+)$', '\1'),
  },
) {

  validate_hash($contexts)
  validate_hash($realms)
  validate_string($server)
  validate_string($service)
  validate_string($engine)
  validate_string($host)

  $owner   = $params::owner
  $group   = $params::group
  $version = $tomcat::version

  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 => template('tomcat/host-header.xml.erb'),
    order   => "50_${service}_50_${host}_00",
  }

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

  file { "${confdir}/${service}/${host}":
    ensure => directory,
    owner  => $owner,
    group  => $group,
    mode   => '2750',
  }

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

}