Puppet Class: pg_profile::database::db_software

Inherits:
pg_profile
Defined in:
manifests/database/db_software.pp

Summary

This class contains the definition of the Postgres software packages you want to use on this system.

Overview

pg_profile::database::db_software

When these customizations aren’t enough, you can replace the class with your own class. See [pg_profile::database](./database.html) for an explanation on how to do this.

See the file “LICENSE” for the full license governing this code.

Parameters:

  • proxy (Optional[String[1]])

    The url of a proxy to use for accessing the Purgres yum server

  • base_url (String[1])

    The base URL for the Postgres yum channel.

  • install_contrib (Boolean)

    If you want to install the Postgres ‘contrib` package, set this value to `true`. The default value is `false`.

  • install_devel (Boolean)

    If you want to install the Postgres ‘devel` package, set this value to `true`. The default value is `false`.

  • install_docs (Boolean)

    If you want to install the Postgres ‘docs` package, set this value to `true`. The default value is `false`.

  • install_llvmjit (Boolean)

    If you want to install the Postgres ‘llvmjit` package, set this value to `true`. The default value is `false`.

  • install_odbc (Boolean)

    If you want to install the Postgres ‘odbc` package, set this value to `true`. The default value is `false`.

  • install_plperl (Boolean)

    If you want to install the Postgres ‘plperl` package, set this value to `true`. The default value is `false`.

  • install_plpython3 (Boolean)

    If you want to install the Postgres ‘plpython3` package, set this value to `true`. The default value is `false`.

  • install_pltcl (Boolean)

    If you want to install the Postgres ‘pltcl` package, set this value to `true`. The default value is `false`.

  • install_test (Boolean)

    If you want to install the Postgres ‘test` package, set this value to `true`. The default value is `false`.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'manifests/database/db_software.pp', line 53

class pg_profile::database::db_software(
  Optional[String[1]] $proxy,
  String[1]           $base_url,
  Boolean             $install_contrib,
  Boolean             $install_devel,
  Boolean             $install_docs,
  Boolean             $install_llvmjit,
  Boolean             $install_odbc,
  Boolean             $install_plperl,
  Boolean             $install_plpython3,
  Boolean             $install_pltcl,
  Boolean             $install_test,
) inherits pg_profile {

  echo {"Ensure Postgres software version ${pg_profile::version}":
    withpath => false,
  }

  #
  # On RedHat8 disable the standard postgresql module in favor of the
  # vendor supplied one that we add later.
  #
  if $::facts['os']['family'] == 'RedHat' and $::facts['os']['release']['major'] == '8' {
    package { 'postgresql':
      ensure   => 'disabled',
      provider => 'dnfmodule'
    }
  }


  $package_version = split($pg_profile::version, '[.]')[0]
  $gpg_key_path    = "/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}"

  easy_type::debug_evaluation() # Show local variable on extended debug

  file { $gpg_key_path:
    source => 'puppet:///modules/pg_profile/postgres-repo.key',
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
  }

  -> yumrepo { 'yum.postgresql.org':
    descr    => "PostgreSQL ${pg_profile::version} \$releasever - \$basearch",
    baseurl  => $base_url,
    enabled  => 1,
    gpgcheck => 1,
    gpgkey   => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}",
    proxy    => $proxy,
  }


  -> package { "postgresql${package_version}-server":
    ensure   => 'present',
    provider => 'yum'
  }

  $additional_packages = ['contrib','devel','docs','llvmjit','odbc','plperl','plpython3','pltcl','test'].each | $package| {
    $value = inline_template("<%= @install_${package} %>")
    if $value == 'true' {
      echo {"Ensure optional Postgres version ${pg_profile::version} package ${package} ":
        withpath => false,
      }

      package { "postgresql${package_version}-${package}":
        ensure  => 'present',
        # require => Package["postgresql${package_version}-server"],
      }
    }
  }
}