Puppet Class: wildfly::service

Defined in:
manifests/service.pp

Overview

Manages Wildfly service.



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

class wildfly::service {

  $config = wildfly::service_config($wildfly::distribution, $wildfly::version, $wildfly::mode, $wildfly::init_system)

  debug("${wildfly::distribution}.${wildfly::version}.${wildfly::mode}.${wildfly::init_system}: ${config}")

  $conf_file = pick($wildfly::conf_file, $config['conf_file'])
  $conf_template = pick($wildfly::conf_template, $config['conf_template'])
  $service_name = pick($wildfly::service_name, $config['service_name'])
  $service_manage   = pick($wildfly::service_manage, $config['service_manage'])
  $service_file = pick($wildfly::service_file, $config['service_file'])
  $systemd_template = pick($wildfly::systemd_template, $config['systemd_template'], 'wildfly/wildfly.sysvinit.service')

  if !$wildfly::package_name {
    contain "wildfly::service::${wildfly::init_system}"
  }

  $conf_dir = dirname($conf_file)

  if $conf_dir != '/etc/default' {

    file { $conf_dir:
      ensure => directory,
      before => File[$conf_file],
    }

  }

  if $service_manage {
    file { $conf_file:
      ensure  => present,
      content => epp($conf_template),
      notify  => Service['wildfly'],
    }
  } else {
    file { $conf_file:
      ensure  => present,
      content => epp($conf_template),
    }
  }

  service { 'wildfly':
    ensure     => $wildfly::service_ensure,
    name       => $service_name,
    enable     => $wildfly::service_enable,
    hasrestart => true,
    hasstatus  => true,
  }

}