Defined Type: tomcat::install

Defined in:
manifests/install.pp

Summary

Configure and manage the tomcat installation

Overview

Parameters:

  • catalina_home (Stdlib::Absolutepath) (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 (Optional[String[1]]) (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 (Optional[ Enum[ 'none', 'http', 'https', 'ftp' ] ]) (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 (Optional[String[1]]) (defaults to: undef)

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

  • allow_insecure (Boolean) (defaults to: false)

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

  • user (Optional[String[1]]) (defaults to: undef)

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

  • group (Optional[String[1]]) (defaults to: undef)

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

  • manage_user (Optional[Boolean]) (defaults to: undef)

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

  • manage_group (Optional[Boolean]) (defaults to: undef)

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

  • manage_home (Optional[Boolean]) (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 (Optional[String[1]]) (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 (Optional[String[1]]) (defaults to: undef)

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

  • package_options (Optional[Array[String[1]]]) (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[1]]]) (defaults to: undef)

    Specifies the default webapps to be removed.



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
112
113
114
115
116
117
118
119
120
121
122
# File 'manifests/install.pp', line 38

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

  # source options
  Optional[String[1]]        $source_url             = undef,
  Boolean                    $source_strip_first_dir = true,
  Optional[
    Enum[
      'none',
      'http',
      'https',
      'ftp'
    ]
  ]                          $proxy_type             = undef,
  Optional[String[1]]        $proxy_server           = undef,
  Boolean                    $allow_insecure         = false,
  Optional[String[1]]        $user                   = undef,
  Optional[String[1]]        $group                  = undef,
  Optional[Boolean]          $manage_user            = undef,
  Optional[Boolean]          $manage_group           = undef,
  Optional[Boolean]          $manage_home            = undef,
  Optional[Array[String[1]]] $remove_default_webapps = undef,

  # package options
  Optional[String[1]]        $package_ensure         = undef,
  Optional[String[1]]        $package_name           = undef,
  Optional[Array[String[1]]] $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| {
      $require_value = $install_from_source? {
        true    => Resource['tomcat::install::source', $name],
        default => Resource['tomcat::install::package', $package_name]
      }

      file { "remove ${folder}" :
        ensure  => absent,
        path    => "${catalina_home}/webapps/${folder}",
        recurse => true,
        purge   => true,
        force   => true,
        require => $require_value,
      }
    }
  }
}