Skip to content

Commit

Permalink
add $ensure parameter for all package operations
Browse files Browse the repository at this point in the history
  • Loading branch information
fraenki committed Jul 29, 2024
1 parent 16a70ab commit e2a447c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
27 changes: 27 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class { 'bacula::client': director_name => 'mydirector.example.com' }
The following parameters are available in the `bacula::client` class:

* [`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)
Expand Down Expand Up @@ -290,6 +291,14 @@ Data type: `Array[String]`

A list of packages to install; loaded from hiera

##### <a name="-bacula--client--ensure"></a>`ensure`

Data type: `String`

What state the package should be in.

Default value: `'present'`

##### <a name="-bacula--client--services"></a>`services`

Data type: `String`
Expand Down Expand Up @@ -491,6 +500,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)
Expand Down Expand Up @@ -525,6 +535,14 @@ Data type: `Array[String]`

A list of packages to install; loaded from hiera

##### <a name="-bacula--director--ensure"></a>`ensure`

Data type: `String`

What state the package should be in.

Default value: `'present'`

##### <a name="-bacula--director--services"></a>`services`

Data type: `String`
Expand Down Expand Up @@ -752,6 +770,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)
Expand Down Expand Up @@ -783,6 +802,14 @@ Data type: `Array[String]`

A list of packages to install; loaded from hiera

##### <a name="-bacula--storage--ensure"></a>`ensure`

Data type: `String`

What state the package should be in.

Default value: `'present'`

##### <a name="-bacula--storage--conf_dir"></a>`conf_dir`

Data type: `String`
Expand Down
4 changes: 3 additions & 1 deletion manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -78,7 +80,7 @@
$config_file = "${conf_dir}/bacula-fd.conf"

package { $packages:
ensure => present,
ensure => $ensure,
}

service { $services:
Expand Down
4 changes: 3 additions & 1 deletion manifests/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -85,7 +87,7 @@
}
)
}
ensure_packages($package_names)
ensure_packages($package_names, { ensure => $ensure })

service { $services:
ensure => running,
Expand Down
4 changes: 3 additions & 1 deletion manifests/storage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
Expand Down Expand Up @@ -54,7 +56,7 @@
}
)
}
ensure_packages($package_names)
ensure_packages($package_names, { ensure => $ensure })

service { $services:
ensure => running,
Expand Down

0 comments on commit e2a447c

Please sign in to comment.