From 5456e1c7701a4baa7a2bd773f6189f82b623837c Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Mon, 29 Jul 2024 13:39:15 +0200 Subject: [PATCH] add $ensure parameter for all package operations --- REFERENCE.md | 27 +++++++++++++++++++++++++++ manifests/client.pp | 4 +++- manifests/director.pp | 4 +++- manifests/storage.pp | 4 +++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 798e5d32..12d81cd1 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -265,6 +265,7 @@ The following parameters are available in the `bacula::client` class: * [`messages`](#-bacula--client--messages) * [`packages`](#-bacula--client--packages) +* [`ensure`](#-bacula--client--ensure) * [`services`](#-bacula--client--services) * [`default_pool`](#-bacula--client--default_pool) * [`default_pool_full`](#-bacula--client--default_pool_full) @@ -298,6 +299,14 @@ Data type: `Array[String[1]]` A list of packages to install; loaded from hiera +##### `ensure` + +Data type: `String[1]` + +What state the package should be in. + +Default value: `'present'` + ##### `services` Data type: `String[1]` @@ -499,6 +508,7 @@ The following parameters are available in the `bacula::director` class: * [`messages`](#-bacula--director--messages) * [`packages`](#-bacula--director--packages) +* [`ensure`](#-bacula--director--ensure) * [`services`](#-bacula--director--services) * [`manage_db`](#-bacula--director--manage_db) * [`conf_dir`](#-bacula--director--conf_dir) @@ -533,6 +543,14 @@ Data type: `Array[String[1]]` A list of packages to install; loaded from hiera +##### `ensure` + +Data type: `String[1]` + +What state the package should be in. + +Default value: `'present'` + ##### `services` Data type: `String[1]` @@ -760,6 +778,7 @@ The following parameters are available in the `bacula::storage` class: * [`services`](#-bacula--storage--services) * [`packages`](#-bacula--storage--packages) +* [`ensure`](#-bacula--storage--ensure) * [`conf_dir`](#-bacula--storage--conf_dir) * [`device`](#-bacula--storage--device) * [`device_mode`](#-bacula--storage--device_mode) @@ -791,6 +810,14 @@ Data type: `Array[String[1]]` A list of packages to install; loaded from hiera +##### `ensure` + +Data type: `String[1]` + +What state the package should be in. + +Default value: `'present'` + ##### `conf_dir` Data type: `Stdlib::Absolutepath` diff --git a/manifests/client.pp b/manifests/client.pp index 4fc303ba..56b8bb9d 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -4,6 +4,7 @@ # # @param messages Logging configuration; loaded from hiera # @param packages A list of packages to install; loaded from hiera +# @param ensure What state the package should be in. # @param services A list of services to operate; loaded from hiera # @param default_pool The name of the Pool for this FD to use by default # @param default_pool_full The name of the Pool to use for Full jobs @@ -59,6 +60,7 @@ Optional[String[1]] $default_pool_full, Optional[String[1]] $default_pool_inc, Optional[String[1]] $default_pool_diff, + String[1] $ensure = 'present', Stdlib::Port $port = 9102, Array[String[1]] $listen_address = [], Bacula::Password $password = 'secret', @@ -80,7 +82,7 @@ $config_file = "${conf_dir}/bacula-fd.conf" package { $packages: - ensure => present, + ensure => $ensure, } service { $services: diff --git a/manifests/director.pp b/manifests/director.pp index 9d9b9761..0c62b53e 100644 --- a/manifests/director.pp +++ b/manifests/director.pp @@ -4,6 +4,7 @@ # # @param messages Logging configuration; loaded from hiera # @param packages A list of packages to install; loaded from hiera +# @param ensure What state the package should be in. # @param services A list of services to operate; loaded from hiera # @param manage_db Whether the module should manage the director database # @param conf_dir Path to bacula configuration directory @@ -39,6 +40,7 @@ Array[String[1]] $packages, String[1] $services, String[1] $make_bacula_tables, + String[1] $ensure = 'present', Bacula::Yesno $manage_db = true, Stdlib::Absolutepath $conf_dir = $bacula::conf_dir, String[1] $db_name = 'bacula', @@ -85,7 +87,7 @@ } ) } - ensure_packages($package_names) + ensure_packages($package_names, { ensure => $ensure }) service { $services: ensure => running, diff --git a/manifests/storage.pp b/manifests/storage.pp index 71040483..1f4ae596 100644 --- a/manifests/storage.pp +++ b/manifests/storage.pp @@ -4,6 +4,7 @@ # # @param services A list of services to operate; loaded from hiera # @param packages A list of packages to install; loaded from hiera +# @param ensure What state the package should be in. # @param conf_dir Path to bacula configuration directory # @param device The system file name of the storage device managed by this storage daemon # @param device_mode The posix mode for device @@ -27,6 +28,7 @@ class bacula::storage ( String[1] $services, Array[String[1]] $packages, + String[1] $ensure = 'present', Stdlib::Absolutepath $conf_dir = $bacula::conf_dir, Stdlib::Absolutepath $device = '/bacula', Stdlib::Filemode $device_mode = '0770', @@ -54,7 +56,7 @@ } ) } - ensure_packages($package_names) + ensure_packages($package_names, { ensure => $ensure }) service { $services: ensure => running,