Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -302,6 +303,17 @@ Default depends on platform.

Default value: `$haproxy::params::config_file`

##### <a name="-haproxy--config_backup"></a>`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`

##### <a name="-haproxy--config_validate_cmd"></a>`config_validate_cmd`

Data type: `Variant[Stdlib::Absolutepath, String]`
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1333,6 +1346,17 @@ Defaults to undef.

Default value: `undef`

##### <a name="-haproxy--instance--config_backup"></a>`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`

##### <a name="-haproxy--instance--config_validate_cmd"></a>`config_validate_cmd`

Data type: `Variant[Stdlib::Absolutepath, String]`
Expand Down
10 changes: 6 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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] {
Expand Down
10 changes: 9 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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,
Expand Down
10 changes: 9 additions & 1 deletion manifests/instance.pp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
@@ -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.
#
Expand All @@ -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' : {
Expand Down
Loading