Cookbooks
haproxy
documentation
Haproxy Config Defaults

Back To Resource List (opens in a new tab)


haproxy_config_defaults

Defaults sets default parameters for all other sections following its declaration. Those default parameters are reset by the next "defaults" section.

Introduced: v4.0.0

Actions

  • :create

Properties

This resource also uses the following partial resources:

NameTypeDefaultDescriptionAllowed Values
timeoutHash{ client: '10s', server: '10s', connect: '10s' }Default HAProxy timeout values
logStringglobalEnable per-instance logging of events and traffic
modeStringhttpSet the running mode or protocol of the instancehttp, tcp
balanceStringroundrobinDefine the load balancing algorithm to be used in a backendroundrobin static-rr, leastconn, first, source, uri, url_param, header, rdp-cookie
statsHash{}Enable HAProxy statistics
maxconnIntegerNoneSets the maximum per-process number of concurrent connections
haproxy_retriesIntegerNoneSet the number of retries to perform on a server after a connection failure
optionArray['httplog', 'dontlognull', 'redispatch', 'tcplog']Array of HAProxy option directives
extra_optionsHashNoneUsed for setting any HAProxy directives
hash_typeString, nilNoneSpecify a method to use for mapping hashes to serversconsistent, map-based, nil

Examples

haproxy_config_defaults 'defaults' do
  mode 'http'
  timeout connect: '5000ms',
          client: '5000ms',
          server: '5000ms'
  haproxy_retries 5
end
haproxy_config_defaults 'defaults' do
  mode 'http'
  timeout connect: '5s',
          client: '50s',
          server: '50s'
  log 'global'
  retries 3
end