diff --git a/REFERENCE.md b/REFERENCE.md
index 7cc9a2e0..00396203 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -134,6 +134,7 @@ The following parameters are available in the `haproxy` class:
* [`custom_fragment`](#-haproxy--custom_fragment)
* [`config_dir`](#-haproxy--config_dir)
* [`config_file`](#-haproxy--config_file)
+* [`config_backup`](#-haproxy--config_backup)
* [`config_validate_cmd`](#-haproxy--config_validate_cmd)
* [`manage_config_dir`](#-haproxy--manage_config_dir)
* [`manage_service`](#-haproxy--manage_service)
@@ -302,6 +303,17 @@ Default depends on platform.
Default value: `$haproxy::params::config_file`
+##### `config_backup`
+
+Data type: `Variant[Boolean, String[1]]`
+
+Specifies whether (and how) to back up the Destination-File before
+overwriting it. Your Value gets passed on to Puppet's native File-Resource
+for execution. Valid Options: true, false, or a string representing either a
+Target-Filebucket or a Filename-Extension beginning with ".".
+
+Default value: `$haproxy::params::config_backup`
+
##### `config_validate_cmd`
Data type: `Variant[Stdlib::Absolutepath, String]`
@@ -1204,6 +1216,7 @@ The following parameters are available in the `haproxy::instance` defined type:
* [`restart_command`](#-haproxy--instance--restart_command)
* [`custom_fragment`](#-haproxy--instance--custom_fragment)
* [`config_file`](#-haproxy--instance--config_file)
+* [`config_backup`](#-haproxy--instance--config_backup)
* [`config_validate_cmd`](#-haproxy--instance--config_validate_cmd)
* [`config_dir`](#-haproxy--instance--config_dir)
* [`merge_options`](#-haproxy--instance--merge_options)
@@ -1333,6 +1346,17 @@ Defaults to undef.
Default value: `undef`
+##### `config_backup`
+
+Data type: `Variant[Boolean, String[1]]`
+
+Specifies whether (and how) to back up the Destination-File before
+overwriting it. Your Value gets passed on to Puppet's native File-Resource
+for execution. Valid Options: true, false, or a string representing either a
+Target-Filebucket or a Filename-Extension beginning with ".".
+
+Default value: `false`
+
##### `config_validate_cmd`
Data type: `Variant[Stdlib::Absolutepath, String]`
diff --git a/manifests/config.pp b/manifests/config.pp
index 29ec0e51..1b310925 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -6,6 +6,7 @@
Variant[Enum['present', 'absent', 'purged', 'disabled', 'installed', 'latest'], String[1]] $package_ensure,
String $instance_name,
Stdlib::Absolutepath $config_file,
+ Variant[Boolean, String[1]] $config_backup,
Hash $global_options,
Hash $defaults_options,
Boolean $chroot_dir_manage,
@@ -54,10 +55,11 @@
file { $_config_file: ensure => absent }
} else {
concat { $_config_file:
- owner => '0',
- group => '0',
- mode => '0640',
- tag => 'haproxy-config',
+ owner => '0',
+ group => '0',
+ mode => '0640',
+ backup => $config_backup,
+ tag => 'haproxy-config',
}
Concat[$_config_file] {
diff --git a/manifests/init.pp b/manifests/init.pp
index 2d696cf8..b1af2865 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -87,13 +87,19 @@
# Optional. Path to the haproxy config file.
# Default depends on platform.
#
+# @param config_backup
+# Specifies whether (and how) to back up the Destination-File before
+# overwriting it. Your Value gets passed on to Puppet's native File-Resource
+# for execution. Valid Options: true, false, or a string representing either a
+# Target-Filebucket or a Filename-Extension beginning with ".".
+#
# @param config_validate_cmd
# Optional. Command used by concat validate_cmd to validate new
# config file concat is a valid haproxy config.
# Default /usr/sbin/haproxy -f % -c
#
# @param manage_config_dir
-# Optional.
+# Optional.
# @param manage_service
# Deprecated
# @param enable
@@ -145,6 +151,7 @@
Optional[String] $custom_fragment = undef,
Stdlib::Absolutepath $config_dir = $haproxy::params::config_dir,
Optional[Stdlib::Absolutepath] $config_file = $haproxy::params::config_file,
+ Variant[Boolean, String[1]] $config_backup = $haproxy::params::config_backup,
Boolean $manage_config_dir = $haproxy::params::manage_config_dir,
Variant[Stdlib::Absolutepath, String] $config_validate_cmd = $haproxy::params::config_validate_cmd,
@@ -197,6 +204,7 @@
custom_fragment => $custom_fragment,
config_dir => $config_dir,
config_file => $config_file,
+ config_backup => $config_backup,
merge_options => $merge_options,
service_options => $service_options,
sysconfig_options => $sysconfig_options,
diff --git a/manifests/instance.pp b/manifests/instance.pp
index 539db278..e5e98fa2 100644
--- a/manifests/instance.pp
+++ b/manifests/instance.pp
@@ -1,6 +1,6 @@
# @summary
# Manages haproxy permitting multiple instances to run on the same machine.
-#
+#
# @note
# Normally users use the Class['haproxy'], which runs a single haproxy
# daemon on a machine.
@@ -74,6 +74,12 @@
# The parent directory will be created automatically.
# Defaults to undef.
#
+# @param config_backup
+# Specifies whether (and how) to back up the Destination-File before
+# overwriting it. Your Value gets passed on to Puppet's native File-Resource
+# for execution. Valid Options: true, false, or a string representing either a
+# Target-Filebucket or a Filename-Extension beginning with ".".
+#
# @param config_validate_cmd
# Command used by concat validate_cmd to validate new
# config file concat is a valid haproxy config.
@@ -179,6 +185,7 @@
Optional[String] $custom_fragment = undef,
Optional[Stdlib::Absolutepath] $config_dir = undef,
Optional[Stdlib::Absolutepath] $config_file = undef,
+ Variant[Boolean, String[1]] $config_backup = false,
Variant[Stdlib::Absolutepath, String] $config_validate_cmd = $haproxy::params::config_validate_cmd,
Boolean $merge_options = $haproxy::params::merge_options,
String $service_options = $haproxy::params::service_options,
@@ -223,6 +230,7 @@
instance_name => $instance_name,
config_dir => $_config_dir,
config_file => $_config_file,
+ config_backup => $config_backup,
global_options => $_global_options,
defaults_options => $_defaults_options,
custom_fragment => $custom_fragment,
diff --git a/manifests/params.pp b/manifests/params.pp
index 70b52397..3e781e6c 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -1,7 +1,7 @@
# @summary
# This is a container class holding default parameters for for haproxy class.
#
-# @note
+# @note
# Currently, only the Redhat family is supported, but this can be easily
# extended by changing package names and configuration file paths.
#
@@ -10,6 +10,7 @@
$service_options = "ENABLED=1\n" # Only used by Debian.
$sysconfig_options = 'OPTIONS=""' #Only used by Redhat/CentOS etc
+ $config_backup = false
case $facts['os']['family'] {
'Archlinux', 'Debian', 'Redhat', 'Gentoo', 'Suse', 'Linux' : {