Skip to content

Latest commit

 

History

History
1985 lines (1272 loc) · 51.2 KB

REFERENCE.md

File metadata and controls

1985 lines (1272 loc) · 51.2 KB

Reference

Table of Contents

Classes

  • haproxy: A Puppet module, using storeconfigs, to model an haproxy configuration. Currently VERY limited - assumes Redhat/CentOS setup. Pull requests a
  • haproxy::globals: For global configuration options used by all haproxy instances.
  • haproxy::params: This is a container class holding default parameters for for haproxy class.

Defined types

Public Defined types

Private Defined types

  • haproxy::balancermember::collect_exported
  • haproxy::config: HAProxy configuration
  • haproxy::install: Install haproxy
  • haproxy::mailer::collect_exported
  • haproxy::service: HAProxy service

Classes

haproxy

A Puppet module, using storeconfigs, to model an haproxy configuration. Currently VERY limited - assumes Redhat/CentOS setup. Pull requests accepted!

Currently requires the puppetlabs/concat module on the Puppet Forge and uses storeconfigs on the Puppet Server to export/collect resources from all balancer members.

Examples

class { 'haproxy':
  global_options   => {
    'log'     => "${::ipaddress} local0",
    'chroot'  => '/var/lib/haproxy',
    'pidfile' => '/var/run/haproxy.pid',
    'maxconn' => '4000',
    'user'    => 'haproxy',
    'group'   => 'haproxy',
    'daemon'  => '',
    'stats'   => 'socket /var/lib/haproxy/stats'
  },
  defaults_options => {
    'log'     => 'global',
    'stats'   => 'enable',
    'option'  => 'redispatch',
    'retries' => '3',
    'timeout' => [
      'http-request 10s',
      'queue 1m',
      'connect 10s',
      'client 1m',
      'server 1m',
      'check 10s'
    ],
    'maxconn' => '8000'
  },
}

Parameters

The following parameters are available in the haproxy class:

package_ensure

Data type: String[1]

Ensure the package is present (installed), absent or a specific version. Defaults to 'present'

Default value: 'present'

package_name

Data type: String

The package name of haproxy. Defaults to 'haproxy' NOTE: haproxy::instance has a different default.

Default value: $haproxy::params::package_name

service_ensure

Data type: Variant[Enum['running', 'stopped'], Boolean]

Chooses whether the haproxy service should be running & enabled at boot, or stopped and disabled at boot. Defaults to 'running'

Default value: 'running'

service_manage

Data type: Boolean

Chooses whether the haproxy service state should be managed by puppet at all. Defaults to true

Default value: true

service_name

Data type: String

The service name for haproxy. Defaults to 'haproxy' NOTE: haproxy::instance has a different default.

Default value: $haproxy::params::service_name

service_options

Data type: String

Contents for the /etc/defaults/haproxy file on Debian. Defaults to "ENABLED=1\n" on Debian, and is ignored on other systems.

Default value: $haproxy::params::service_options

chroot_dir_manage

Data type: Boolean

Chooses whether the haproxy chroot directory should be managed by puppet at all. Defaults to true

Default value: true

sysconfig_options

Data type: Any

Contents for the /etc/sysconfig/haproxy file on RedHat(-based) systems. Defaults to OPTIONS="" on RedHat(-based) systems and is ignored on others

Default value: $haproxy::params::sysconfig_options

global_options

Data type: Hash

A hash of all the haproxy global options. If you want to specify more than one option (i.e. multiple timeout or stats options), pass those options as an array and you will get a line for each of them in the resultant haproxy.cfg file.

Default value: $haproxy::params::global_options

defaults_options

Data type: Hash

A hash of all the haproxy defaults options. If you want to specify more than one option (i.e. multiple timeout or stats options), pass those options as an array and you will get a line for each of them in the resultant haproxy.cfg file.

Default value: $haproxy::params::defaults_options

merge_options

Data type: Boolean

Whether to merge the user-supplied global_options/defaults_options hashes with their default values set in params.pp. Merging allows to change or add options without having to recreate the entire hash. Defaults to false, but will default to true in future releases.

Default value: $haproxy::params::merge_options

restart_command

Data type: Any

Command to use when restarting the on config changes. Passed directly as the 'restart' parameter to the service resource. Defaults to undef i.e. whatever the service default is.

Default value: undef

custom_fragment

Data type: Any

Allows arbitrary HAProxy configuration to be passed through to support additional configuration not available via parameters, or to short-circute the defined resources such as haproxy::listen when an operater would rather just write plain configuration. Accepts a string (ie, output from the template() function). Defaults to undef

Default value: undef

config_dir

Data type: Stdlib::Absolutepath

Path to the directory in which the main configuration file haproxy.cfg resides. Will also be used for storing any managed map files (see haproxy::mapfile). Default depends on platform.

Default value: $haproxy::params::config_dir

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path to the haproxy config file. Default depends on platform.

Default value: $haproxy::params::config_file

config_validate_cmd

Data type: Any

Optional. Command used by concat validate_cmd to validate new config file concat is a valid haproxy config. Default /usr/sbin/haproxy -f % -c

Default value: $haproxy::params::config_validate_cmd

manage_config_dir

Data type: Any

Optional.

Default value: $haproxy::params::manage_config_dir

manage_service

Data type: Any

Deprecated

Default value: undef

enable

Data type: Any

Deprecated

Default value: undef

haproxy::globals

For global configuration options used by all haproxy instances.

Parameters

The following parameters are available in the haproxy::globals class:

sort_options_alphabetic

Data type: Boolean

Sort options either alphabetic or custom like haproxy internal sorts them. Defaults to true.

Default value: true

haproxy::params

This is a container class holding default parameters for for haproxy class.

  • Note Currently, only the Redhat family is supported, but this can be easily extended by changing package names and configuration file paths.

Defined types

haproxy::backend

=== Authors

Gary Larizza [email protected] Jeremy Kitchen [email protected]

  • Note Each backend service needs one or more backend member servers (that can be declared with the haproxy::balancermember defined resource type). Using storeconfigs, you can export the haproxy::balancermember resources on all load balancer member servers and then collect them on a single haproxy load balancer server.

Examples

haproxy::backend { 'puppet00':
  options   => {
    'option'  => [
      'tcplog',
      'ssl-hello-chk'
    ],
    'balance' => 'roundrobin'
  },
}

Parameters

The following parameters are available in the haproxy::backend defined type:

section_name

Data type: Any

This name goes right after the 'backend' statement in haproxy.cfg Default: $name (the namevar of the resource).

Default value: $name

mode

Data type: Any

The mode of operation for the backend service. Valid values are undef, 'tcp', 'http', and 'health'.

Default value: undef

description

Data type: Any

Allows to add a sentence to describe the related object in the HAProxy HTML stats page. The description will be printed on the right of the object name it describes. Usefull in huge environments

Default value: undef

options

Data type: Any

A hash of options that are inserted into the backend configuration block.

Default value: { 'balance' => 'roundrobin', }

collect_exported

Data type: Any

Boolean, default 'true'. True means 'collect exported @@balancermember resources' (for the case when every balancermember node exports itself), false means 'rely on the existing declared balancermember resources' (for the case when you know the full set of balancermember in advance and use haproxy::balancermember with array arguments, which allows you to deploy everything in 1 run)

Default value: true

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

sort_options_alphabetic

Data type: Any

Sort options either alphabetic or custom like haproxy internal sorts them. Defaults to true.

Default value: undef

defaults

Data type: Any

Name of the defaults section this backend will use. Defaults to undef which means the global defaults section will be used.

Default value: undef

instance

Data type: Any

Optional. Defaults to 'haproxy'

Default value: 'haproxy'

haproxy::balancermember

This type will setup a balancer member inside a listening service configuration block in /etc/haproxy/haproxy.cfg on the load balancer.

  • Note Currently it only has the ability to specify the instance name, ip address, port, and whether or not it is a backup. More features can be added as needed. The best way to implement this is to export this resource for all haproxy balancer member servers, and then collect them on the main haproxy load balancer.

Examples

Exporting the resource for a balancer member:

@@haproxy::balancermember { 'haproxy':
  listening_service => 'puppet00',
  ports             => '8140',
  server_names      => $::hostname,
  ipaddresses       => $::ipaddress,
  options           => 'check',
}

Collecting the resource on a load balancer

Haproxy::Balancermember <<| listening_service == 'puppet00' |>>
Creating the resource for multiple balancer members at once
(for single-pass installation of haproxy without requiring a first
pass to export the resources if you know the members in advance):

haproxy::balancermember { 'haproxy':
  listening_service => 'puppet00',
  ports             => '8140',
  server_names      => ['server01', 'server02'],
  ipaddresses       => ['192.168.56.200', '192.168.56.201'],
  options           => 'check',
}
Implemented in HAPROXY 1.8:
Set a template to initialize servers with shared parameters.
The names of these servers are built from <prefix> and <amount> parameters.

  Initializes 5 servers with srv1, srv2, srv3, srv4 and srv5 as names,
  myserver.example.com as FQDN, 8140 as port, and health-check enabled.

haproxy::balancermember { 'haproxy':
  listening_service => 'puppet00',
  type              => 'server-template'
  port              => '8140',
  prefix            => 'srv',
  amount            => '1-5',
  fqdn              => 'myserver.example.com',
  options           => 'check',
}

(this resource can be declared anywhere)

Parameters

The following parameters are available in the haproxy::balancermember defined type:

listening_service

Data type: Any

The haproxy service's instance name (or, the title of the haproxy::listen resource). This must match up with a declared haproxy::listen resource.

ports

Data type: Any

An array or commas-separated list of ports for which the balancer member will accept connections from the load balancer. Note that cookie values aren't yet supported, but shouldn't be difficult to add to the configuration. If you use an array in server_names and ipaddresses, the same port is used for all balancermembers.

Default value: undef

port

Data type: Any

A port for server-template. It is an optional specification.

Default value: undef

server_names

Data type: Any

The name of the balancer member server as known to haproxy in the listening service's configuration block. This defaults to the hostname. Can be an array of the same length as ipaddresses, in which case a balancermember is created for each pair of server_names and ipaddresses (in lockstep).

Default value: $::hostname

ipaddresses

Data type: Any

The ip address used to contact the balancer member server. Can be an array, see documentation to server_names.

Default value: $::ipaddress

prefix

Data type: Any

A prefix for the server-template for the server names to be built.

Default value: 'server'

amount

Data type: Any

If "amount" is provided, the server-template initializes servers with 1 up to as server name suffixes. A range of numbers <num_low>-<num_high> may also be used to use <num_low> up to <num_high> as server name suffixes.

Default value: '1'

fqdn

Data type: Any

A FQDN for all the servers the server-template initializes.

Default value: ''

options

Data type: Any

An array of options to be specified after the server declaration in the listening service's configuration block.

Default value: ''

define_cookies

Data type: Any

If true, then add "cookie SERVERID" stickiness options. Default false.

Default value: false

defaults

Data type: Any

Name of the defaults section the backend or listener use. Defaults to undef.

Default value: undef

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

verifyhost

Data type: Any

Optional. Will add the verifyhost option to the server line, using the specific host from server_names as an argument. Default: false

Default value: false

weight

Data type: Any

Optional. Will add the weight option to the server line Default: undef

Default value: undef

instance

Data type: Any

Optional. Defaults to 'haproxy'

Default value: 'haproxy'

type

Data type: Enum['server', 'default-server', 'server-template']

Optional. Defaults to 'server'

Default value: 'server'

haproxy::defaults

This type will setup a additional defaults configuration block inside the haproxy.cfg file on an haproxy load balancer.

  • Note A new default configuration block resets all defaults of prior defaults configuration blocks. Listener, Backends, Frontends and Balancermember can be configured behind a default configuration block by setting the defaults parameter to the corresponding defaults name.

Parameters

The following parameters are available in the haproxy::defaults defined type:

options

Data type: Any

A hash of options that are inserted into the defaults configuration block.

Default value: {}

sort_options_alphabetic

Data type: Any

Sort options either alphabetic or custom like haproxy internal sorts them. Defaults to true.

Default value: undef

instance

Data type: Any

Optional. Defaults to 'haproxy'.

Default value: 'haproxy'

haproxy::frontend

=== Authors

Gary Larizza [email protected]

  • Note Currently requires the puppetlabs/concat module on the Puppet Forge and uses storeconfigs on the Puppet Server to export/collect resources from all balancer members.

Examples

Exporting the resource for a balancer member:

haproxy::frontend { 'puppet00':
  ipaddress    => $::ipaddress,
  ports        => '18140',
  mode         => 'tcp',
  bind_options => 'accept-proxy',
  options      => {
    'option'   => [
      'tcplog',
      'accept-invalid-http-request',
    ],
    'timeout client' => '30s',
    'balance'    => 'roundrobin'
  },
}

Parameters

The following parameters are available in the haproxy::frontend defined type:

section_name

Data type: Any

This name goes right after the 'frontend' statement in haproxy.cfg Default: $name (the namevar of the resource).

Default value: $name

ports

Data type: Any

Ports on which the proxy will listen for connections on the ip address specified in the ipaddress parameter. Accepts either a single comma-separated string or an array of strings which may be ports or hyphenated port ranges.

Default value: undef

bind

Data type: Optional[Hash]

Set of ip addresses, port and bind options $bind = { '10.0.0.1:80' => ['ssl', 'crt', '/path/to/my/crt.pem'] }

Default value: undef

ipaddress

Data type: Any

The ip address the proxy binds to. Empty addresses, '*', and '0.0.0.0' mean that the proxy listens to all valid addresses on the system.

Default value: undef

mode

Data type: Any

The mode of operation for the frontend service. Valid values are undef, 'tcp', 'http', and 'health'.

Default value: undef

description

Data type: Any

Allows to add a sentence to describe the related object in the HAProxy HTML stats page. The description will be printed on the right of the object name it describes. Usefull in huge environments

Default value: undef

bind_options

Data type: Any

(Deprecated) An array of options to be specified after the bind declaration in the listening serivce's configuration block.

Default value: ''

options

Data type: Any

A hash of options that are inserted into the frontend service configuration block.

Default value: { 'option' => [ 'tcplog', ], }

sort_options_alphabetic

Data type: Any

Sort options either alphabetic or custom like haproxy internal sorts them. Defaults to true.

Default value: undef

defaults

Data type: Any

Name of the defaults section this backend will use. Defaults to undef which means the global defaults section will be used.

Default value: undef

defaults_use_backend

Data type: Any

If defaults are used and a default backend is configured use the backend name for ordering. This means that the frontend is placed in the configuration file before the backend configuration. Defaults to true.

Default value: true

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

collect_exported

Data type: Any

Boolean. Default true

Default value: true

instance

Data type: Any

Optional. Defaults to 'haproxy'

Default value: 'haproxy'

haproxy::instance

template() function). Defaults to undef

  • Note Normally users use the Class['haproxy'], which runs a single haproxy daemon on a machine.

Examples

A single instance of haproxy with all defaults
i.e. emulate Class['haproxy']
 package{ 'haproxy': ensure => present }->haproxy::instance { 'haproxy': }->
 haproxy::listen { 'puppet00':
   instance         => 'haproxy',
   collect_exported => false,
   ipaddress        => $::ipaddress,
   ports            => '8140',
 }
Multiple instances of haproxy:
 haproxy::instance { 'group1': }
 haproxy::instance_service { 'group1':
   haproxy_init_source => "puppet:///modules/${module_name}/haproxy-group1.init",
 }
 haproxy::listen { 'puppet00':
   instance         => 'group1',
   collect_exported => false,
   ipaddress        => $::ipaddress,
   ports            => '8800',
   requires         => Package['haproxy'],
 }
 haproxy::instance { 'group2': }
 haproxy::instance_service { 'group2':
   haproxy_init_source => "puppet:///modules/${module_name}/haproxy-group1.init",
 }
 haproxy::listen { 'puppet00':
   instance         => 'group2',
   collect_exported => false,
   ipaddress        => $::ipaddress,
   ports            => '9900',
   requires         => Package['haproxy'],
 }
Multiple instances of haproxy, one with a custom haproxy package:
 haproxy::instance { 'group1': }
 haproxy::instance_service { 'group1':
   haproxy_init_source => "puppet:///modules/${module_name}/haproxy-group1.init",
 }
 haproxy::listen { 'puppet00':
   instance         => 'group1',
   collect_exported => false,
   ipaddress        => $::ipaddress,
   ports            => '8800',
   requires         => Package['haproxy'],
 }
 haproxy::instance { 'group2': }
 haproxy::instance_service { 'group2':
   haproxy_package     => 'custom_haproxy',
   haproxy_init_source => "puppet:///modules/${module_name}/haproxy-group2.init",
 }
 haproxy::listen { 'puppet00':
   instance         => 'group2',
   collect_exported => false,
   ipaddress        => $::ipaddress,
   ports            => '9900',
   requires         => Package['haproxy'],
 }

Parameters

The following parameters are available in the haproxy::instance defined type:

package_ensure

Data type: String[1]

Ensure the package is present (installed), absent or a specific version. Defaults to 'present'

Default value: 'present'

package_name

Data type: Optional[String]

The package name of haproxy. Defaults to undef, and no package is installed. NOTE: Class['haproxy'] has a different default.

Default value: undef

service_ensure

Data type: Variant[Enum['running', 'stopped'], Boolean]

Chooses whether the haproxy service should be running & enabled at boot, or stopped and disabled at boot. Defaults to 'running'

Default value: 'running'

service_manage

Data type: Boolean

Chooses whether the haproxy service state should be managed by puppet at all. Defaults to true

Default value: true

chroot_dir_manage

Data type: Boolean

Chooses whether the haproxy chroot directory should be managed by puppet at all. Defaults to true

Default value: true

service_name

Data type: Optional[String]

The service name for haproxy. Defaults to undef. If no name is given then the value computed for $instance_name will be used. NOTE: Class['haproxy'] has a different default.

Default value: undef

global_options

Data type: Optional[Hash]

A hash of all the haproxy global options. If you want to specify more than one option (i.e. multiple timeout or stats options), pass those options as an array and you will get a line for each of them in the resultant haproxy.cfg file.

Default value: undef

defaults_options

Data type: Optional[Hash]

A hash of all the haproxy defaults options. If you want to specify more than one option (i.e. multiple timeout or stats options), pass those options as an array and you will get a line for each of them in the resultant haproxy.cfg file.

Default value: undef

restart_command

Data type: Any

Command to use when restarting the on config changes. Passed directly as the 'restart' parameter to the service resource. # Defaults to undef i.e. whatever the service default is.

Default value: undef

custom_fragment

Data type: Any

Allows arbitrary HAProxy configuration to be passed through to support additional configuration not available via parameters, or to short-circuit the defined resources such as haproxy::listen when an operater would rather just write plain configuration. Accepts a string (ie, output from the

Default value: undef

config_file

Data type: Optional[Stdlib::Absolutepath]

Allows arbitrary config filename to be specified. If this is used, it is assumed that the directory path to the file exists and has owner/group/permissions as desired. If set to undef, the name will be generated as follows: If $title is 'haproxy', the operating system default will be used. Otherwise, /etc/haproxy-$title/haproxy-$title.conf (Linux), or /usr/local/etc/haproxy-$title/haproxy-$title.conf (FreeBSD) The parent directory will be created automatically. Defaults to undef.

Default value: undef

config_validate_cmd

Data type: Any

Command used by concat validate_cmd to validate new config file concat is a valid haproxy config. Default /usr/sbin/haproxy -f % -c

Default value: $haproxy::params::config_validate_cmd

config_dir

Data type: Any

Optional. Default undef.

Default value: undef

merge_options

Data type: Any

Default value: $haproxy::params::merge_options

service_options

Data type: Any

Default value: $haproxy::params::service_options

sysconfig_options

Data type: Any

Default value: $haproxy::params::sysconfig_options

haproxy::instance_service

Set up the environment for an haproxy service.

  • Note * Associate an haproxy instance with the haproxy package it should use.
  • Create the start/restart/stop functions needed by Service[]. In other words: sets things up so that Service[$instance_name] will work.

In particular:

  • Create a link to the binary an instance will be using. This way each instance can link to a different binary. If you have an instance called "foo", you know "haproxy-foo" is a link to the binary it should be using.
  • Create an init.d file named after the instance. This way Service[$instance] can start/restart the service.

Parameters

The following parameters are available in the haproxy::instance_service defined type:

haproxy_package

Data type: String

The name of the package to be installed. This is useful if you package your own custom version of haproxy. Defaults to 'haproxy'

Default value: 'haproxy'

bindir

Data type: Stdlib::Absolutepath

Where to put symlinks to the binary used for each instance. Defaults to '/opt/haproxy'

Default value: '/opt/haproxy/bin'

haproxy_init_source

Data type: Optional[String]

The init.d script that will start/restart/reload this instance.

Default value: undef

haproxy_unit_template

Data type: String

Default value: 'haproxy/instance_service_unit.erb'

haproxy::listen

=== Authors

Gary Larizza [email protected]

  • Note Each listening service configuration needs one or more load balancer member server (that can be declared with the haproxy::balancermember defined resource type). Using storeconfigs, you can export the haproxy::balancermember resources on all load balancer member servers, and then collect them on a single haproxy load balancer server.

Examples

haproxy::listen { 'puppet00':
  ipaddress => $::ipaddress,
  ports     => '18140',
  mode      => 'tcp',
  options   => {
    'option'  => [
      'tcplog',
      'ssl-hello-chk'
    ],
    'balance' => 'roundrobin'
  },
}

Parameters

The following parameters are available in the haproxy::listen defined type:

section_name

Data type: Any

This name goes right after the 'listen' statement in haproxy.cfg Default: $name (the namevar of the resource).

Default value: $name

ports

Data type: Any

Ports on which the proxy will listen for connections on the ip address specified in the ipaddress parameter. Accepts either a single comma-separated string or an array of strings which may be ports or hyphenated port ranges.

Default value: undef

ipaddress

Data type: Any

The ip address the proxy binds to. Empty addresses, '*', and '0.0.0.0' mean that the proxy listens to all valid addresses on the system.

Default value: undef

bind

Data type: Optional[Hash]

Set of ip addresses, port and bind options $bind = { '10.0.0.1:80' => ['ssl', 'crt', '/path/to/my/crt.pem'] }

Default value: undef

mode

Data type: Any

The mode of operation for the listening service. Valid values are undef, 'tcp', 'http', and 'health'.

Default value: undef

description

Data type: Any

Allows to add a sentence to describe the related object in the HAProxy HTML stats page. The description will be printed on the right of the object name it describes. Usefull in huge environments

Default value: undef

options

Data type: Any

A hash of options that are inserted into the listening service configuration block.

Default value: { 'option' => [ 'tcplog', ], 'balance' => 'roundrobin', }

bind_options

Data type: Any

(Deprecated) An array of options to be specified after the bind declaration in the listening serivce's configuration block.

Default value: ''

collect_exported

Data type: Any

Boolean, default 'true'. True means 'collect exported @@balancermember resources' (for the case when every balancermember node exports itself), false means 'rely on the existing declared balancermember resources' (for the case when you know the full set of balancermembers in advance and use haproxy::balancermember with array arguments, which allows you to deploy everything in 1 run)

Default value: true

sort_options_alphabetic

Data type: Any

Sort options either alphabetic or custom like haproxy internal sorts them. Defaults to true.

Default value: undef

defaults

Data type: Any

Name of the defaults section this backend will use. Defaults to undef which means the global defaults section will be used.

Default value: undef

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

instance

Data type: Any

Optional. Defaults to 'haproxy'

Default value: 'haproxy'

haproxy::mailer

This type will set up a mailer entry inside the mailers configuration block in haproxy.cfg on the load balancer.

  • Note Currently, it has the ability to specify the instance name, ip address, ports and server_names. Automatic discovery of mailer nodes may be implemented by exporting the mailer resource for all HAProxy balancer servers that are configured in the same HA block and then collecting them on all load balancers.

Parameters

The following parameters are available in the haproxy::mailer defined type:

mailers_name

Data type: Any

Specifies the mailer in which this load balancer needs to be added.

server_names

Data type: Any

Sets the name of the mailer server in the mailers configuration block. Defaults to the hostname. Can be an array. If this parameter is specified as an array, it must be the same length as the ipaddresses parameter's array. A mailer is created for each pair of server_names and ipaddresses in the array.

Default value: $::hostname

ipaddresses

Data type: Any

Specifies the IP address used to contact the mailer member server. Can be an array. If this parameter is specified as an array it must be the same length as the server_names parameter's array. A mailer is created for each pair of address and server_name.

Default value: $::ipaddress

port

Data type: Any

Sets the port on which the mailer is going to share the state.

instance

Data type: Any

Default value: 'haproxy'

haproxy::mailers

This type will set up a mailers entry in haproxy.cfg on the load balancer.

  • Note This setting makes it possible to send emails during state changes.

Parameters

The following parameters are available in the haproxy::mailers defined type:

instance

Data type: Any

Optional. Defaults to 'haproxy'.

Default value: 'haproxy'

collect_exported

Data type: Any

Boolean. Defaults to true.

Default value: true

haproxy::mapfile

Manage an HAProxy map file as documented in https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#7.3.1-map

  • Note A map file contains one key + value per line. These key-value pairs are specified in the mappings array or by additional haproxy::mapfile::entry definitions.

Parameters

The following parameters are available in the haproxy::mapfile defined type:

name

The namevar of the defined resource type is the filename of the map file (without any extension), relative to the haproxy::config_dir directory. A '.map' extension will be added automatically.

mappings

Data type: Array[Variant[String, Hash]]

An array of mappings for this map file. Array elements may be Hashes with a single key-value pair each (preferably) or simple Strings. Default: []

Default value: []

ensure

Data type: Enum['present', 'absent']

The state of the underlying file resource, either 'present' or 'absent'. Default: 'present'

Default value: 'present'

owner

Data type: Any

The owner of the underlying file resource. Defaut: 'root'

Default value: 'root'

group

Data type: Any

The group of the underlying file resource. Defaut: 'root'

Default value: 'root'

mode

Data type: Any

The mode of the underlying file resource. Defaut: '0644'

Default value: '0644'

instances

Data type: Array

Array of managed HAproxy instance names to notify (restart/reload) when the map file is updated. This is so that the same map file can be used with multiple HAproxy instances. Default: [ 'haproxy' ]

Default value: ['haproxy']

haproxy::mapfile::entry

Manage an HAProxy map file as documented in https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#7.3.1-map

  • Note A map file contains one key + value per line. These key-value pairs are specified in the mappings array.

Parameters

The following parameters are available in the haproxy::mapfile::entry defined type:

name

The namevar of the defined resource type is the filename of the map file (without any extension), relative to the haproxy::config_dir directory. A '.map' extension will be added automatically.

mappings

Data type: Array[Variant[String, Hash]]

An array of mappings for this map file. Array elements may be Hashes with a single key-value pair each (preferably) or simple Strings. Default: []

Default value: [$title]

mapfile

Data type: String

order

Data type: Variant[String, Integer]

Default value: '10'

haproxy::peer

This type will set up a peer entry inside the peers configuration block in haproxy.cfg on the load balancer.

  • Note Currently, it has the ability to specify the instance name, ip address, ports and server_names.

Parameters

The following parameters are available in the haproxy::peer defined type:

peers_name

Data type: Any

Specifies the peer in which this load balancer needs to be added.

server_names

Data type: Any

Sets the name of the peer server in the peers configuration block. Defaults to the hostname. Can be an array. If this parameter is specified as an array, it must be the same length as the ipaddresses parameter's array. A peer is created for each pair of server_names and ipaddresses in the array.

Default value: $::hostname

ipaddresses

Data type: Any

Specifies the IP address used to contact the peer member server. Can be an array. If this parameter is specified as an array it must be the same length as the server_names parameter's array. A peer is created for each pair of address and server_name.

Default value: $::ipaddress

port

Data type: Any

Sets the port on which the peer is going to share the state.

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

instance

Data type: Any

Default value: 'haproxy'

haproxy::peer::collect_exported

Private define

haproxy::peers

on the load balancer. This setting is required to share the current state of HAproxy with other HAproxy in High available configurations.

Parameters

The following parameters are available in the haproxy::peers defined type:

name

Sets the peers' name. Generally it will be the namevar of the defined resource type. This value appears right after the 'peers' statement in haproxy.cfg

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

instance

Data type: String

Optional. Defaults to 'haproxy'

Default value: 'haproxy'

collect_exported

Data type: Boolean

Boolean. Defaults to true

Default value: true

haproxy::resolver

=== Authors

Gary Larizza [email protected] Ricardo Rosales [email protected]

  • Note Currently requires the puppetlabs/concat module on the Puppet Forge and uses storeconfigs on the Puppet Server to export/collect resources from all balancer members.

Examples

Exporting the resource for a balancer member:

haproxy::resolver { 'puppet00':
  nameservers           => {
    'dns1' => '10.0.0.1:53',
    'dns2' => '10.0.0.2:53'
  },
  hold                  => {
    'nx'    => '30s',
    'valid' => '10s'
  },
  resolve_retries       => 3,
  timeout               => {
    'retry' => '1s'
  },
  accepted_payload_size => 512,
}

Parameters

The following parameters are available in the haproxy::resolver defined type:

section_name

Data type: Any

This name goes right after the 'resolvers' statement in haproxy.cfg Default: $name (the namevar of the resource).

Default value: $name

nameservers

Data type: Any

Set of id, ip addresses and port options. $nameservers = { 'dns1' => '10.0.0.1:53', 'dns2' => '10.0.0.2:53' }

Default value: undef

hold

Data type: Any

Defines during which the last name resolution should be kept based on last valid resolution status. $hold = { 'nx' => '30s', 'valid' => '10s' }

Default value: undef

resolve_retries

Data type: Any

Defines the number of queries to send to resolve a server name before giving up. $resolve_retries = 3

Default value: undef

timeout

Data type: Any

Defines timeouts related to name resolution in the listening serivce's configuration block. $timeout = { 'retry' => '1s' }

Default value: undef

accepted_payload_size

Data type: Any

Defines the maximum payload size accepted by HAProxy and announced to all the name servers configured in this resolvers section. is in bytes. If not set, HAProxy announces 512. (minimal value defined by RFC 6891) Note: the maximum allowed value is 8192.

Default value: undef

collect_exported

Data type: Any

Boolean, default 'true'. True means 'collect exported @@balancermember resources' (for the case when every balancermember node exports itself), false means 'rely on the existing declared balancermember resources' (for the case when you know the full set of balancermember in advance and use haproxy::balancermember with array arguments, which allows you to deploy everything in 1 run)

Default value: true

config_file

Data type: Any

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

sort_options_alphabetic

Data type: Any

Sort options either alphabetic or custom like haproxy internal sorts them. Defaults to true.

Default value: undef

defaults

Data type: Any

Name of the defaults section this backend will use. Defaults to undef which means the global defaults section will be used.

Default value: undef

instance

Data type: Any

Optional. Defaults to 'haproxy'

Default value: 'haproxy'

haproxy::userlist

=== Authors

Jeremy Kitchen [email protected]

Parameters

The following parameters are available in the haproxy::userlist defined type:

section_name

Data type: String

This name goes right after the 'userlist' statement in haproxy.cfg Default: $name (the namevar of the resource).

Default value: $name

users

Data type: Optional[Array[Variant[String, Sensitive[String]]]]

An array of users in the userlist. See http://cbonte.github.io/haproxy-dconv/configuration-1.4.html#3.4-user

Default value: undef

groups

Data type: Optional[Array[String]]

An array of groups in the userlist. See http://cbonte.github.io/haproxy-dconv/configuration-1.4.html#3.4-group

Default value: undef

config_file

Data type: Optional[Stdlib::Absolutepath]

Optional. Path of the config file where this entry will be added. Assumes that the parent directory exists. Default: $haproxy::params::config_file

Default value: undef

instance

Data type: String

Optional. Defaults to 'haproxy'

Default value: 'haproxy'