Defined Type: wildfly::resource

Defined in:
manifests/resource.pp

Overview

Manages a Wildfly configuration resource: e.g /subsystem=datasources/data-source=MyDS or /subsystem=datasources/jdbc-driver=postgresql. Virtually anything in your configuration XML file that can be manipulated using JBoss-CLI could be managed by this defined type. This define is a wrapper for wildfly_resource that defaults to your local Wildfly installation.

Parameters:

  • ensure (Enum[present, absent]) (defaults to: present)

    Whether the resource should exist (present) or not (absent).

  • recursive (Boolean) (defaults to: false)

    Whether it should manage the resource recursively or not.

  • undefine_attributes (Boolean) (defaults to: false)

    Whether it should undefine attributes with undef value.

  • content (Hash) (defaults to: {})

    Sets the content/state of the target resource.

  • operation_headers (Hash) (defaults to: {})

    Sets operation-headers (e.g. { 'allow-resource-service-restart' => true, 'rollback-on-runtime-failure' => false, 'blocking-timeout' => 600}) to be used when creating/destroying this resource.

  • profile (Optional[String]) (defaults to: undef)

    Sets the target profile to prefix resource name. Requires domain mode.

  • mgmt_user (Hash[Enum['username','password'], String])
  • port_properties (Hash[Enum['management-http','management-https','ajp','http','https'], Integer[1024]])
  • ip_properties (Hash[Enum['management','public'], Stdlib::Compat::Ip_address])


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

define wildfly::resource(
  Hash[Enum['username','password'], String]                                            $mgmt_user,
  Hash[Enum['management-http','management-https','ajp','http','https'], Integer[1024]] $port_properties,
  Hash[Enum['management','public'], Stdlib::Compat::Ip_address]                        $ip_properties,
  Enum[present, absent]                                                                $ensure = present,
  Boolean                                                                              $recursive = false,
  Boolean                                                                              $undefine_attributes = false,
  Hash                                                                                 $content = {},
  Hash                                                                                 $operation_headers = {},
  Optional[String]                                                                     $profile = undef,
) {

  $resource_info = split($title, ':')
  $resource = $resource_info[0]
  $catalina_home = $resource_info[1]

  $profile_path = wildfly::profile_path($profile)

  if $undefine_attributes {
    $attributes = $content
  } else {
    $attributes = delete_undef_values($content)
  }

  wildfly_resource { "${profile_path}${resource}:${catalina_home}":
    ensure            => $ensure,
    path              => "${profile_path}${resource}",
    username          => $mgmt_user['username'],
    password          => $mgmt_user['password'],
    host              => $ip_properties['management'],
    port              => $port_properties['management-http'],
    recursive         => $recursive,
    state             => $attributes,
    operation_headers => $operation_headers,
  }
}