Defined Type: postfix::lookup::mysql

Defined in:
vendor_modules/postfix/manifests/lookup/mysql.pp

Overview

Define a MySQL lookup table.

Parameters:

  • hosts (Array[Postfix::Type::Lookup::MySQL::Host, 1])
  • user (String)
  • password (String)
  • dbname (String)
  • query (String)
  • ensure (Enum['present', 'absent']) (defaults to: 'present')
  • path (Stdlib::Absolutepath) (defaults to: $title)
  • result_format (Optional[String]) (defaults to: undef)
  • domain (Optional[Array[String, 1]]) (defaults to: undef)
  • expansion_limit (Optional[Integer[0]]) (defaults to: undef)
  • option_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • option_group (Optional[String]) (defaults to: undef)
  • tls_cert (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_key (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_ca_cert_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_ca_cert_dir (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_verify_cert (Optional[Boolean]) (defaults to: undef)

See Also:

Since:

  • 1.0.0



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
# File 'vendor_modules/postfix/manifests/lookup/mysql.pp', line 24

define postfix::lookup::mysql (
  Array[Postfix::Type::Lookup::MySQL::Host, 1] $hosts,
  String                                       $user,
  String                                       $password,
  String                                       $dbname,
  String                                       $query,
  Enum['present', 'absent']                    $ensure           = 'present',
  Stdlib::Absolutepath                         $path             = $title,
  Optional[String]                             $result_format    = undef,
  Optional[Array[String, 1]]                   $domain           = undef,
  Optional[Integer[0]]                         $expansion_limit  = undef,
  Optional[Stdlib::Absolutepath]               $option_file      = undef,
  Optional[String]                             $option_group     = undef,
  Optional[Stdlib::Absolutepath]               $tls_cert         = undef,
  Optional[Stdlib::Absolutepath]               $tls_key          = undef,
  Optional[Stdlib::Absolutepath]               $tls_ca_cert_file = undef,
  Optional[Stdlib::Absolutepath]               $tls_ca_cert_dir  = undef,
  Optional[Boolean]                            $tls_verify_cert  = undef,
) {

  include postfix

  $_hosts = postfix::flatten_hosts($hosts)

  $_ensure = $ensure ? {
    'absent' => 'absent',
    default  => 'file',
  }

  file { $path:
    ensure  => $_ensure,
    owner   => 0,
    group   => 0,
    mode    => '0600',
    content => template("${module_name}/mysql.cf.erb"),
  }

  if $ensure != 'absent' and has_key($postfix::lookup_packages, 'mysql') {
    $mysql_package = $postfix::lookup_packages['mysql']
    ensure_packages([$mysql_package])
    Package[$mysql_package] -> File[$path]
  }
}