Defined Type: openondemand::conf

Defined in:
manifests/conf.pp

Summary

Manage Open OnDemand configuration file in /etc/ood/config/ondemand.d

Overview

Parameters:

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

    The source of the configuration file

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

    The content template of the configuration file

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

    The template to define content

  • data (Optional[Hash]) (defaults to: undef)

    A hash of data to convert to YAML that defines the configuration file contents

  • template (Boolean) (defaults to: false)

    If true, the file will have .yml.erb extension, otherwise the extension is .yml

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

    Override the default filename for the configuration file



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

define openondemand::conf (
  Optional[String] $source = undef,
  Optional[String] $content = undef,
  Optional[String] $content_template = undef,
  Optional[Hash] $data = undef,
  Boolean $template = false,
  Optional[String] $filename = undef,
) {
  if ! $source and ! $content and ! $content_template and ! $data {
    fail('Defined type openondemand::conf: Must define either source, content, content_template or data')
  }

  if $template {
    $extension = 'yml.erb'
  } else {
    $extension = 'yml'
  }

  $_filename = pick($filename, "${name}.${extension}")

  if $data {
    $_content = join([
        '# File managed by Puppet - DO NOT EDIT',
        to_yaml($data),
        '',
    ], "\n")
  } elsif $content_template {
    $_content = template($content_template)
  } else {
    $_content = $content
  }

  include openondemand

  file { "/etc/ood/config/ondemand.d/${_filename}":
    ensure  => 'file',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => $_content,
    source  => $source,
    notify  => Class['openondemand::service'],
  }
}