From 2cdfd93708c2cbd94c71c5745192720eeeddedcb Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Fri, 18 Apr 2025 22:06:28 +0200 Subject: [PATCH] adds installation --- manifests/main/config.pp | 2 +- manifests/main/install.pp | 23 +++++++++++++++++++++++ manifests/params.pp | 19 ++++++++++++++++++- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 manifests/main/install.pp diff --git a/manifests/main/config.pp b/manifests/main/config.pp index bb25999..3f0443e 100644 --- a/manifests/main/config.pp +++ b/manifests/main/config.pp @@ -6,5 +6,5 @@ class postgresql_cd::main::config ( ) inherits postgresql_cd::params { - + include postgresql_cd::main::install } diff --git a/manifests/main/install.pp b/manifests/main/install.pp new file mode 100644 index 0000000..9c485ae --- /dev/null +++ b/manifests/main/install.pp @@ -0,0 +1,23 @@ +## postgresql_cd::main::install.pp +# Module name: postgresql_cd +# Author: Arne Teuke (arne_teuke@confdroid.com) +# @summary Class manages logic for the postgresql_cd module. +############################################################################## +class postgresql_cd::main::install ( + +) inherits postgresql_cd::params { + if $fqdn == $pl_server_fqdn { + package { $reqpackages_server: + ensure => $pkg_ensure, + } + package { $reqpackages_client: + ensure => $pkg_ensure, + } + } + + if $fqdn != $pl_server_fqdn { + package { $reqpackages_client: + ensure => $pkg_ensure, + } + } +} diff --git a/manifests/params.pp b/manifests/params.pp index 1d03ca5..375a5d4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,13 +1,30 @@ ## postgresql_cd::params.pp # Module name: postgresql_cd # Author: Arne Teuke (arne_teuke@confdroid.com) +# @param [string] pl_server_fqdn the fqdn of the postgresql server. Any other +# system will be configured as client +# @param [string] reqpackages_server the packages for the server +# @param [string] reqpackages_client the packages for the client +# @param [string] pkg_ensure which version of the packages to install, i.e. +# 'latest', 'present' '13.20', # @summary Class contains all parameters for the postgresql_cd module. ############################################################################## class postgresql_cd::params ( + String $pl_server_fqdn = undef, + + # installation + String $reqpackages_server = 'postgresql-server', + String $reqpackages_client = 'postgresql', + String $pkg_ensure = 'latest', + + ) { + $fqdn = $facts['networking']['fqdn'] + $domain = $facts['networking']['domain'] + $os_name = $facts['os']['name'] + $os_release = $facts['os']['release']['major'] # includes must be last include postgresql_cd::main::config - }