Puppet Function: wildfly::service_config

Defined in:
functions/service_config.pp
Function type:
Puppet Language

Overview

wildfly::service_config(String $distribution, String $version, String $mode, Enum['sysvinit', 'systemd', 'upstart'] $init_system)Hash[String, String]

Default service configuration for a specific distribution, version

execution mode and initsystem.

Parameters:

  • distribution (String)

    Wildfly distribution: 'wildfly' or 'jboss-eap'.

  • version (String)

    Wildfly version.

  • mode (String)

    Wildfly execution mode will run, 'standalone' or 'domain'.

  • init_system (Enum['sysvinit', 'systemd', 'upstart'])

    System's initsystem.

Returns:

  • (Hash[String, String])

    service configuration: name, configuration file and template and bundled init scripts.



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
# File 'functions/service_config.pp', line 9

function wildfly::service_config(
  String $distribution,
  String $version,
  String $mode,
  Enum['sysvinit', 'systemd', 'upstart'] $init_system) {

  case $distribution {

    # intentionally not using $facts (see rspec-puppet #503)

    'wildfly' : {
      $conf_file = $::osfamily ? {
        'Debian' => '/etc/default/wildfly',
        default  => '/etc/default/wildfly.conf'
      }

      $service_file = "wildfly-init-${downcase($::osfamily)}.sh"

      case [versioncmp($version, '10'), $init_system] {
        [-1, default] : {
          {
            'service_name'     => 'wildfly',
            'conf_file'        => $conf_file,
            'conf_template'    => 'wildfly/wildfly.sysvinit.conf',
            'service_file'     => "bin/init.d/${service_file}",
          }
        }
        [default, 'systemd'] : {
          {
            'service_name'     => 'wildfly',
            'conf_file'        => '/etc/wildfly/wildfly.conf',
            'conf_template'    => 'wildfly/wildfly.systemd.conf',
            'service_file'     => "docs/contrib/scripts/init.d/${service_file}",
            'systemd_template' => 'wildfly/wildfly.systemd.service',
          }
        }
        [default, default] : {
          {
            'service_name'     => 'wildfly',
            'conf_file'        => $conf_file,
            'conf_template'    => 'wildfly/wildfly.sysvinit.conf',
            'service_file'     => "docs/contrib/scripts/init.d/${service_file}",
          }
        }
      }
    }
    'jboss-eap' : {
      case versioncmp($version, '7') {
        -1 : {
          {
            'service_name'     => 'jboss-as',
            'conf_file'        => '/etc/jboss-as/jboss-as.conf',
            'conf_template'    => 'wildfly/wildfly.sysvinit.conf',
            'service_file'     => "bin/init.d/jboss-as-${mode}.sh",
          }
        }
        default : {
          {
            'service_name'     => 'jboss-eap',
            'conf_file'        => '/etc/default/jboss-eap.conf',
            'conf_template'    => 'wildfly/wildfly.sysvinit.conf',
            'service_file'     => 'bin/init.d/jboss-eap-rhel.sh',
          }
        }
      }
    }
  }
}