Puppet Class: sendmail::genericstable

Defined in:
manifests/genericstable.pp

Summary

Manage the Sendmail genericstable db file.

Overview

The class manages the file either as a single file resource or each entry in the file separately. The file is managed as a whole using the ‘source` or `content` parameters. The `entries` parameter is used to manage each entry separately. Preferable this is done with hiera using automatic parameter lookup.

Use the ‘sendmail::mc::generics_domain` type to configure the domains for which non-local user addresses should be rewritten.

Examples:

Manage the generictable using hiera

class { 'sendmail::genericstable': }

Manage the generictable using the provided file

class { 'sendmail::genericstable':
  source => 'puppet:///modules/sendmail/genericstable',
}

Parameters:

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

    The desired contents of the genericstable file. This allows managing the genericstable file as a whole. Changes to the file automatically triggers a rebuild of the genericstable database file. This attribute is mutually exclusive with ‘source` and `entries`.

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

    A source file for the genericstable file. This allows managing the genericstable file as a whole. Changes to the file automatically triggers a rebuild of the genericstable database file. This attribute is mutually exclusive with ‘content` and `entries`.

  • entries (Hash[String,Data]) (defaults to: {})

    A hash that will be used to create ‘sendmail::genericstable::entry` resources. This class can be used to create genericstable entries defined in hiera. The hiera hash should look like this:

    “‘yaml sendmail::genericstable::entries:

    'fred@example.com':
      value: 'fred@example.org'
    'barney':
      value: 'barney@example.org'
    

    “‘



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

class sendmail::genericstable (
  Optional[String]  $content = undef,
  Optional[String]  $source  = undef,
  Hash[String,Data] $entries = {},
) {
  if ($content and $source) {
    fail('You cannot specify more than one of content, source, entries')
  }

  if ($content or $source) {
    if !empty($entries) {
      fail('You cannot specify more than one of content, source, entries')
    }

    class { 'sendmail::genericstable::file':
      content => $content,
      source  => $source,
    }
  }
  elsif !empty($entries) {
    $entries.each |$entry,$attributes| {
      sendmail::genericstable::entry { $entry:
        * => $attributes,
      }
    }
  }
}