From ba96a65368f5930a40074302b324b9474599eb75 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 --- manifests/client.pp | 4 +++- manifests/director.pp | 4 +++- manifests/storage.pp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index dcaf1cbe..77d30cf8 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -3,6 +3,7 @@ # This class installs and configures the File Daemon to backup a client system. # # @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 @@ -57,6 +58,7 @@ Optional[String] $default_pool_full, Optional[String] $default_pool_inc, Optional[String] $default_pool_diff, + String $ensure = 'present', Integer $port = 9102, Array[String[1]] $listen_address = [], String $password = 'secret', @@ -78,7 +80,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 40e0b7b1..dad73a21 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] $packages, String $services, String $make_bacula_tables, + String $ensure = 'present', Bacula::Yesno $manage_db = true, String $conf_dir = $bacula::conf_dir, String $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 f407d648..00fe6f40 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 $services, Array[String] $packages, + String $ensure = 'present', String $conf_dir = $bacula::conf_dir, String $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,