Defined Type: tomcat::probe

Defined in:
manifests/probe.pp

Overview

Definition: tomcat::probe

Download and deploy psi-probe, a fork of the popular lambda-probe.

A webapp named “probe” is deployed in the tomcat instance of the same name than the definition.

Parameters:

  • name: must be the same as the tomcat instance in which the webapp must be installed into.

  • ensure: present/absent, defaults to present.

  • version: the version of psi-probe to use, defaults to 2.0.4.

Example usage:

include tomcat::v6
tomcat::probe    { "foobar": ensure => present }
tomcat::instance { "foobar": http_port => 8080, ensure => running }

It is (currently) left to the user to configure a mandatory username to access the web interface. This can be done for example this way:

cat << EOF > /srv/tomcat/foobar/conf/tomcat-users.xml
<tomcat-users>
  <role rolename="probeuser" />
  <role rolename="poweruser" />
  <role rolename="poweruserplus" />
  <user username="admin" password="t0psecret" roles="manager,admin" />
</tomcat-users>
EOF

Following this example, you should be able to point your browser to localhost:8080/probe/

See also: code.google.com/p/psi-probe/

Parameters:

  • ensure (Any) (defaults to: 'present')
  • version (Any) (defaults to: '2.0.4')


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

define tomcat::probe($ensure='present', $version='2.0.4') {

  validate_re($ensure, ['present','absent'])

  $url="https://github.com/psi-probe/psi-probe/releases/download/${version}/probe-${version}.zip"

  $sha1sum = $version ? {
    '2.0.4' => '2207bbc4a45af7e3cff2dfbd9377848f1b807387',
  }
  $probe_name = "psi-probe-${version}"

  archive { $probe_name:
    source        => $url,
    path          => "/var/tmp/${probe_name}.zip",
    digest_string => $sha1sum,
    digest_type   => 'sha1',
    extract       => true,
    #extension     => 'zip',
    extract_path  => "/usr/src/${probe_name}",
    creates       => "/usr/src/${probe_name}/probe.war",
    # hack to avoid the exec reexecuting always, as the zip file contains no
    # base directory.
    #root_dir      => 'probe.war',
  }

  file { "/srv/tomcat/${name}/webapps/probe.war":
    ensure  => $ensure,
    source  => "file:///usr/src/psi-probe-${version}/probe.war",
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => Archive["psi-probe-${version}"],
    notify  => Service["tomcat-${name}"],
  }
}