Defined Type: tomcat::vhost

Defined in:
manifests/vhost.pp

Overview

Define: tomcat::vhost

This define adds a vhost to tomcat

Parameters

hostname

String. Hostname for the vhost Default: $name

aliases

String or Array of Strings. Aliases to associate with this vhost Default: ”

unpackWARs

Boolean. Should wars be unpacked? Default: true

autoDeploy

Boolean. Should new wars be auto-deployed? Default: true

contexts

Array of Hashes. Contexts to install in this vhost. Allowed keys: base, path, reloadable Default ”

Examples

  • Installation: tomcat::vhost { ‘www’:

    aliases  => $serverAliases,
    contexts => $contexts,
    

    }

Authors

Parameters:

  • hostname (Any) (defaults to: undef)
  • aliases (Any) (defaults to: undef)
  • unpackWARs (Any) (defaults to: true)
  • autoDeploy (Any) (defaults to: true)
  • contexts (Any) (defaults to: undef)
  • contextReloadable (Any) (defaults to: false)


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

define tomcat::vhost (
  $hostname = undef,
  $aliases = undef,
  $unpackWARs = true,
  $autoDeploy = true,
  $contexts = undef,
  $contextReloadable = false,
){

  if !defined(Class['tomcat']) {
    fail('You must include the tomcat base class before using any tomcat defined resources')
  }

  $sites_mode = $::disposition ? {
    /(dev|vagrant)/ => '0777',
    default         => '0775',
  }

  if $hostname {
    $hostname_real = $hostname
  } else {
    $hostname_real = $name
  }

  $install_dir = $tomcat::install_dir

  $appBase_real = "sites/${hostname_real}"

  file { "${install_dir}/tomcat/sites/${hostname_real}":
    ensure => directory,
    owner  => tomcat,
    group  => tomcat,
    mode   => $sites_mode,
  }

  concat::fragment{ "server_xml_${name}":
    target  => "${install_dir}/tomcat/conf/server.xml",
    content => template('tomcat/vhost.xml'),
    order   => 10,
  }
}