Defined Type: tomcat::install

Defined in:
manifests/install.pp

Summary

Configure and manage the tomcat installation

Overview

Parameters:

  • catalina_home (Any) (defaults to: $name)

    specifies the directory of the Tomcat installation from which the instance should be created. Valid options: a string containing an absolute path.

  • name

    ‘$catalina_home`

  • install_from_source (Boolean) (defaults to: true)

    Specifies whether to install from source or from a package. If set to ‘true` installation uses the `source_url`, `source_strip_first_dir`, `user`, `group`, `manage_user`, and `manage_group` parameters. If set to `false` installation uses the `package_ensure`, `package_name`, and `package_options` parameters. Valid options: Boolean. `true`.

  • source_url (Any) (defaults to: undef)

    In single-instance mode: Specifies the source URL to install from. Valid options: a string containing a ‘puppet://`, `http(s)://`, or `ftp://` URL.

  • source_strip_first_dir (Boolean) (defaults to: true)

    Specifies whether to strip the topmost directory of the tarball when unpacking it. Only valid if ‘install_from_source` is set to `true`.

  • proxy_type (Any) (defaults to: undef)

    Specifies the proxy server type used by ‘proxy_server`. Normally this defaults to the protocol specified in the `proxy_server` URI. `proxy_server`. Valid options: ’none’, ‘http’, ‘https’, ‘ftp’.

  • proxy_server (Any) (defaults to: undef)

    Specifies a proxy server to use when downloading Tomcat binaries. For example, ‘example.com:8080’.

  • allow_insecure (Any) (defaults to: false)

    Specifies if HTTPS errors should be ignored when downloading the source tarball. Valid options: Boolean.

  • user (Any) (defaults to: undef)

    Specifies the owner of the source installation directory. ‘$::tomcat::user`.

  • group (Any) (defaults to: undef)

    Specifies the group of the source installation directory. ‘$::tomcat::group`.

  • manage_user (Any) (defaults to: undef)

    Specifies whether the user should be managed by this module or not. ‘$::tomcat::manage_user`.

  • manage_group (Any) (defaults to: undef)

    Specifies whether the group should be managed by this module or not. ‘$::tomcat::manage_group`.

  • manage_home (Any) (defaults to: undef)

    Specifies whether the directory of catalina_home should be managed by puppet. This may not be preferable in network filesystem environments.

  • package_ensure (Any) (defaults to: undef)

    Determines whether the specified package should be installed. Only valid if ‘install_from_source` is set to `false`. Maps to the `ensure` parameter of Puppet’s native [package](docs.puppetlabs.com/references/latest/type.html#package).

  • package_name (Any) (defaults to: undef)

    Specifies the package to install. Valid options: a string containing a valid package name.

  • package_options (Any) (defaults to: undef)

    Specify additional options to use on the generated package resource. See the documentation of the [package](docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for possible values.

  • remove_default_webapps (Optional[Array[String]]) (defaults to: undef)


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

define tomcat::install (
  $catalina_home                  = $name,
  Boolean $install_from_source    = true,

  # source options
  $source_url                     = undef,
  Boolean $source_strip_first_dir = true,
  $proxy_type                     = undef,
  $proxy_server                   = undef,
  $allow_insecure                 = false,
  $user                           = undef,
  $group                          = undef,
  $manage_user                    = undef,
  $manage_group                   = undef,
  $manage_home                    = undef,
  Optional[Array[String]] $remove_default_webapps     = undef,

  # package options
  $package_ensure                 = undef,
  $package_name                   = undef,
  $package_options                = undef,
) {
  include ::tomcat
  $_user = pick($user, $::tomcat::user)
  $_group = pick($group, $::tomcat::group)
  $_manage_user = pick($manage_user, $::tomcat::manage_user)
  $_manage_group = pick($manage_group, $::tomcat::manage_group)
  $_manage_home = pick($manage_home, $::tomcat::manage_home)
  tag(sha1($catalina_home))

  if $install_from_source {
    if $_manage_user {
      ensure_resource('user', $_user, {
          ensure => present,
          gid    => $_group,
      })
    }
    if $_manage_group {
      ensure_resource('group', $_group, {
          ensure => present,
      })
    }
    tomcat::install::source { $name:
      catalina_home          => $catalina_home,
      manage_home            => $_manage_home,
      source_url             => $source_url,
      source_strip_first_dir => $source_strip_first_dir,
      proxy_type             => $proxy_type,
      proxy_server           => $proxy_server,
      allow_insecure         => $allow_insecure,
      user                   => $_user,
      group                  => $_group,
    }
  } else {
    tomcat::install::package { $package_name:
      package_ensure  => $package_ensure,
      package_options => $package_options,
    }
  }

  if $remove_default_webapps {
    $remove_default_webapps.each |$folder| {
      file { "remove ${folder}" :
        ensure  => absent,
        path    => "${catalina_home}/webapps/${folder}",
        recurse => true,
        purge   => true,
        force   => true,
        require => $install_from_source ? {
          true    => Resource['tomcat::install::source', $name],
          default => Resource['tomcat::install::package', $package_name]
        },
      }
    }
  }
}