Defined Type: wildfly::instance

Defined in:
manifests/instance.pp

Overview

definition wildfly::instance

Parameters:

  • catalina_home (Optional[Stdlib::Unixpath]) (defaults to: undef)
  • user (Optional[String]) (defaults to: undef)
  • group (Optional[String]) (defaults to: undef)
  • manage_user (Optional[Boolean]) (defaults to: undef)
  • manage_group (Optional[Boolean]) (defaults to: undef)
  • manage_service (Optional[Boolean]) (defaults to: true)
  • jacorb_port_properties (Optional[Hash[Enum['jacorb','jacorb-ssl'], Integer[1024]]]) (defaults to: undef)
  • port_properties (Optional[Hash[Enum['management-http','management-https','ajp','http','https'], Integer[1024]]]) (defaults to: undef)
  • ip_properties (Optional[Hash[Enum['management','public','unsecure'], Stdlib::Compat::Ip_address]]) (defaults to: undef)
  • java_home (Optional[Stdlib::Unixpath]) (defaults to: undef)
  • java_opts (Optional[String]) (defaults to: undef)
  • java_xms (Optional[String]) (defaults to: '256m')
  • java_xmx (Optional[String]) (defaults to: '512m')
  • remote_debug (Optional[Boolean]) (defaults to: false)
  • remote_debug_port (Optional[Integer[1024]]) (defaults to: 8787)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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/instance.pp', line 3

define wildfly::instance (
  Optional[Stdlib::Unixpath] $catalina_home          = undef,
  Optional[String]           $user                   = undef,
  Optional[String]           $group                  = undef,
  Optional[Boolean]          $manage_user            = undef,
  Optional[Boolean]          $manage_group           = undef,
  Optional[Boolean]          $manage_service         = true,
  Optional[Hash[Enum['jacorb','jacorb-ssl'], Integer[1024]]]
    $jacorb_port_properties                          = undef,
  Optional[Hash[Enum['management-http','management-https','ajp','http','https'], Integer[1024]]]
    $port_properties                                 = undef,
  Optional[Hash[Enum['management','public','unsecure'], Stdlib::Compat::Ip_address]]
    $ip_properties                                   = undef,
  Optional[Stdlib::Unixpath] $java_home              = undef,
  Optional[String]           $java_opts              = undef,
  Optional[String]           $java_xms               = '256m',
  Optional[String]           $java_xmx               = '512m',
  Optional[Boolean]          $remote_debug           = false,
  Optional[Integer[1024]]    $remote_debug_port      = 8787,
) {
  include ::wildfly
  $_catalina_home = pick($catalina_home, $::wildfly::catalina_home)
  tag(sha1($_catalina_home))
  $_user = pick($user, $::wildfly::user)
  $_group = pick($group, $::wildfly::group)
  $_manage_user = pick($manage_user, $::wildfly::manage_user)
  $_manage_group = pick($manage_group, $::wildfly::manage_group)

  wildfly::instance::dependencies { $name:
    catalina_home => $_catalina_home,
  }

  file { "${_catalina_home}/bin/standalone.conf":
    ensure  => 'file',
    owner   => $_user,
    group   => $_group,
    mode    => '0644',
    content => epp('wildfly/standalone.conf.epp', {
      'java_opts'         => $java_opts,
      'java_xms'          => $java_xms,
      'java_xmx'          => $java_xmx,
      'remote_debug'      => $remote_debug,
      'remote_debug_port' => $remote_debug_port,
      }),
  }

  if $manage_service {
    wildfly::service { $name:
      catalina_home  => $_catalina_home,
      java_home      => $java_home,
      service_ensure => 'running',
      service_enable => $manage_service,
      user           => $_user,
      group          => $_group,
      subscribe      => File["${_catalina_home}/bin/standalone.conf"],
    }
  }
  if $port_properties {
    $port_properties.each |$_connector_name,$_connector_port| {
      wildfly::config::connector { "${_catalina_home} ${_connector_name} standalone.xml":
        catalina_home  => $_catalina_home,
        connector_name => $_connector_name,
        connector_port => $_connector_port,
      }
    }
  }
  if $ip_properties {
    $ip_properties.each |$_interface,$_ip_address| {
      # be sure interface insecure exists in standalone.xml
      if $_interface == 'unsecure' {
        augeas { "add_${catalina_home} ${_interface}":
          context => "/files/${catalina_home}/standalone/configuration/standalone.xml",
          lens    => 'Xml.lns',
          incl    => "${catalina_home}/standalone/configuration/standalone.xml",
          changes => [
            "set server/interfaces/interface[#attribute/name=\"${_interface}\"]/#attribute/name ${_interface}",
          ],
        }
      }
      wildfly::config::interface { "${_catalina_home} ${_interface} standalone.xml":
        catalina_home => $_catalina_home,
        ip_address    => $_ip_address,
        interface     => $_interface,
      }
    }
  }
  if $jacorb_port_properties {
    $jacorb_port_properties.each |$_connector_name,$_connector_port| {
      # be sure jacorb socket-bindings exists on interface unsecure in standalone.conf
      augeas { "add_${catalina_home} ${_connector_name}":
        context => "/files/${catalina_home}/standalone/configuration/standalone.xml",
        lens    => 'Xml.lns',
        incl    => "${catalina_home}/standalone/configuration/standalone.xml",
        changes => [
          "set server/socket-binding-group/socket-binding[#attribute/name=\"${_connector_name}\"]/#attribute/name ${_connector_name}",
          "set server/socket-binding-group/socket-binding[#attribute/name=\"${_connector_name}\"]/#attribute/interface unsecure",
        ],
      }
      wildfly::config::connector { "${_catalina_home} ${_connector_name} standalone.xml":
        catalina_home  => $_catalina_home,
        connector_name => $_connector_name,
        connector_port => $_connector_port,
      }
    }
  }
  wildfly::user::mgmt_user { "${wildfly::mgmt_user['username']}:${_catalina_home}":
    password => $wildfly::mgmt_user['password'],
  }
}