2025-03-02 16:28:57 +01:00
|
|
|
## haproxy_cd::params.pp
|
|
|
|
|
# Module name: haproxy_cd
|
2018-04-24 15:32:11 +02:00
|
|
|
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
2018-12-18 16:23:09 +01:00
|
|
|
# @param [string] pkg_ensure
|
2018-04-24 15:32:11 +02:00
|
|
|
# which [package type](https://confdroid.com/2017/05/puppet-type-package/)
|
|
|
|
|
# to choose, i.e. `latest` or `present`.
|
2025-03-02 16:28:57 +01:00
|
|
|
# @param [string] reqpackages specify the packages to be installed
|
|
|
|
|
# @param [string] hy_host_fqdn the fqdn of the ha proxy host. must be fqdn,
|
2018-04-24 15:32:11 +02:00
|
|
|
# not cname. specify multiple fqdns via array.
|
2018-12-18 16:23:09 +01:00
|
|
|
# @param [boolean] hy_manage_fw whether to manage the firewall.
|
2025-03-02 16:28:57 +01:00
|
|
|
# @param [string] hy_fw_order_no the rule number to control the order of the
|
2018-04-24 15:32:11 +02:00
|
|
|
# firewall rules.
|
2018-12-18 16:23:09 +01:00
|
|
|
# @param [string] hy_http_port the http port. used in firewall settings
|
|
|
|
|
# @param [string] hy_https_port the https port. used in firewall settings
|
|
|
|
|
# @param [string] hy_user_name the name of the haproxy service user.
|
|
|
|
|
# @param [string] hy_user_comment the comment of the haproxy user, shows up
|
2018-12-10 16:12:32 +01:00
|
|
|
# in emails sent from haproxy.
|
2025-03-02 16:28:57 +01:00
|
|
|
# @param [string] hy_user_home the home directory for the haproxy user.
|
2018-12-18 16:23:09 +01:00
|
|
|
# @param [string] hy_user_shell the shell for the haproxy user.
|
|
|
|
|
# @param [string] hy_log_target Where to send the logs for this haproxy.
|
2018-12-10 16:57:53 +01:00
|
|
|
# Currently only local logging / rsyslog forwarding supported.
|
2018-12-18 16:23:09 +01:00
|
|
|
# @param [string] hy_log_facility which logging facility to use.
|
2018-12-10 16:57:53 +01:00
|
|
|
# @param [string] hy_chroot where the chroot should be
|
2018-12-18 16:23:09 +01:00
|
|
|
# @param [string] hy_pid the pid file to use.
|
2018-12-10 16:57:53 +01:00
|
|
|
# @param [string] hy_maxconn how many connections should we max allow.
|
|
|
|
|
# @param [boolean] hy_show_stats whether we want to display the statistics page
|
2018-12-18 16:23:09 +01:00
|
|
|
# @param [string] hy_stats_socket name and path of the stats socket
|
|
|
|
|
# @param [string] hy_default_mode which mode to use in the defaults block
|
2018-12-19 16:07:59 +01:00
|
|
|
# @param [string] hy_log_default should be used when the instance's logging
|
|
|
|
|
# parameters are the same as the global ones.
|
|
|
|
|
# @param [boolean] hy_use_httplog whether to use httplogging option. Enable
|
|
|
|
|
# logging of HTTP request, session state and timers
|
|
|
|
|
# @param [boolean] hy_use_dontlognull Whether to enable or disable dontlognull
|
|
|
|
|
# option. true enables, false disables.
|
2018-12-24 16:51:00 +01:00
|
|
|
# @param [boolean] hy_use_http_server_close Enable or disable HTTP connection
|
|
|
|
|
# closing on the server side
|
|
|
|
|
# @param [boolean] hy_use_forward_for Enable insertion of the
|
|
|
|
|
# X-Forwarded-For header to requests sent to servers.
|
|
|
|
|
# @param [boolean] hy_use_redispatch Enable or disable session redistribution
|
|
|
|
|
# in case of connection failure.
|
|
|
|
|
# @param [string] hy_max_retries Set the number of retries to perform on a
|
|
|
|
|
# server after a connection failure.
|
|
|
|
|
# @param [string] hy_timeout_http_request Set the maximum allowed time to wait
|
|
|
|
|
# for a complete HTTP request.
|
|
|
|
|
# @param [string] hy_timeout_queue Set the maximum time to wait in the queue
|
|
|
|
|
# for a connection slot to be free.
|
2021-09-10 16:30:48 +02:00
|
|
|
# @param [string] hy_timeout_connect Set the maximum time to wait for a
|
2018-12-24 16:51:00 +01:00
|
|
|
# connection attempt to a server to succeed.
|
|
|
|
|
# @param [string] hy_timeout_client Set the maximum inactivity time on the
|
|
|
|
|
# client side.
|
|
|
|
|
# @param [string] hy_timeout_server Set the maximum inactivity time on the
|
|
|
|
|
# server side.
|
2025-03-02 16:28:57 +01:00
|
|
|
# @param [string] hy_timeout_http_keep_alive set the timeout value for
|
2021-09-10 16:30:48 +02:00
|
|
|
# keeping https connections alive
|
|
|
|
|
# @param [string] hy_timeout_check set the timeout value for how long to check
|
2025-03-02 16:28:57 +01:00
|
|
|
# if the timeout has occurred
|
|
|
|
|
# @param [boolean] hy_manage_fail2ban whether to integrate fail2ban
|
|
|
|
|
# @param [boolean] hy_use_http_server_close whether to use this in global mode
|
|
|
|
|
# @param [boolean] hy_use_forward_for whether to use this in global mode
|
|
|
|
|
# @param [boolean] hy_use_redispatch whether to use this in global mode
|
|
|
|
|
# @param [string] hy_max_retries max retries value
|
|
|
|
|
# @param [string] hy_timeout_connect timeout for connections
|
|
|
|
|
# @param [string] hy_timeout_client timeout for client connections
|
|
|
|
|
# @param [string] hy_timeout_server timeout for server response
|
|
|
|
|
# @param [boolean] hy_hard_stop whether to use hard stop for service restart
|
|
|
|
|
# @param [string] hy_hard_stop_value which value to use for hard stop
|
|
|
|
|
# @param [string] hy_stats_auth credentials to use for stats authentication
|
|
|
|
|
# @param [string] hy_log_local0 settings for logging to local0
|
|
|
|
|
# @param [string] hy_log_local1 settings for logging to local1
|
|
|
|
|
# @param [boolean] hy_use_tcplog whether to use tcplog as default
|
|
|
|
|
# @param [boolean] hy_use_httplog whether to use httplog as default
|
|
|
|
|
# @param [boolean] hy_use_dontlognull whether to use dontlognull as default
|
|
|
|
|
# @param [string] hy_be_userlist backend userlist comment
|
|
|
|
|
# @param [boolean] hy_manage_be_users whether to manage backend users
|
2018-12-10 16:12:32 +01:00
|
|
|
###############################################################################
|
2025-03-02 16:28:57 +01:00
|
|
|
class haproxy_cd::params (
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2025-03-02 16:28:57 +01:00
|
|
|
String $pkg_ensure = 'latest',
|
|
|
|
|
String $reqpackages = ['haproxy','httpd-tools'],
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2025-03-02 16:28:57 +01:00
|
|
|
String $hy_host_fqdn = undef,
|
2018-04-24 15:32:11 +02:00
|
|
|
|
|
|
|
|
# firewall
|
2025-03-02 16:28:57 +01:00
|
|
|
Boolean $hy_manage_fw = true,
|
|
|
|
|
String $hy_fw_order_no = '50',
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2025-02-14 11:36:23 +01:00
|
|
|
# fail2ban
|
2025-03-02 16:28:57 +01:00
|
|
|
Boolean $hy_manage_fail2ban = false,
|
2025-02-14 11:36:23 +01:00
|
|
|
|
2018-04-24 15:32:11 +02:00
|
|
|
# main config
|
2025-03-02 16:28:57 +01:00
|
|
|
String $hy_http_port = '80',
|
|
|
|
|
String $hy_https_port = '443',
|
|
|
|
|
String $hy_chroot = '/var/lib/haproxy',
|
|
|
|
|
String $hy_pid = '/var/run/haproxy.pid',
|
|
|
|
|
String $hy_maxconn = '4000',
|
|
|
|
|
Boolean $hy_show_stats = false,
|
|
|
|
|
String $hy_stats_socket = '/var/lib/haproxy/stats',
|
|
|
|
|
String $hy_default_mode = 'tcp',
|
|
|
|
|
Boolean $hy_use_http_server_close = false,
|
|
|
|
|
Boolean $hy_use_forward_for = false,
|
|
|
|
|
Boolean $hy_use_redispatch = true,
|
|
|
|
|
String $hy_max_retries = '3',
|
|
|
|
|
String $hy_timeout_http_request = '10s',
|
|
|
|
|
String $hy_timeout_queue = '1m',
|
|
|
|
|
String $hy_timeout_connect = '10s',
|
|
|
|
|
String $hy_timeout_client = '1m',
|
|
|
|
|
String $hy_timeout_server = '1m',
|
|
|
|
|
String $hy_timeout_http_keep_alive = '10s',
|
|
|
|
|
String $hy_timeout_check = '10s',
|
|
|
|
|
Boolean $hy_hard_stop = true,
|
|
|
|
|
String $hy_hard_stop_value = '60s',
|
|
|
|
|
String $hy_stats_auth = 'admin:password',
|
2018-12-10 14:36:54 +01:00
|
|
|
|
|
|
|
|
# user
|
2025-03-02 16:28:57 +01:00
|
|
|
String $hy_user_name = 'haproxy',
|
|
|
|
|
String $hy_user_comment = 'haproxy user',
|
|
|
|
|
String $hy_user_home = '/var/lib/haproxy',
|
|
|
|
|
String $hy_user_shell = '/sbin/nologin',
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2018-12-10 16:57:53 +01:00
|
|
|
# logging
|
2025-03-02 16:28:57 +01:00
|
|
|
String $hy_log_local0 = '127.0.0.1:514 local0',
|
|
|
|
|
String $hy_log_local1 = '127.0.0.1:514 local1 notice',
|
|
|
|
|
String $hy_log_target = '127.0.0.1',
|
|
|
|
|
String $hy_log_facility = 'local2',
|
|
|
|
|
String $hy_log_default = 'global',
|
|
|
|
|
Boolean $hy_use_tcplog = true,
|
|
|
|
|
Boolean $hy_use_httplog = false,
|
|
|
|
|
Boolean $hy_use_dontlognull = true,
|
|
|
|
|
Boolean $hy_manage_be_users = false,
|
|
|
|
|
String $hy_be_userlist = '####',
|
2025-02-12 11:45:09 +01:00
|
|
|
|
2018-04-24 15:32:11 +02:00
|
|
|
) {
|
2025-03-02 16:28:57 +01:00
|
|
|
# service
|
|
|
|
|
$hy_service = 'haproxy'
|
2018-04-24 15:32:11 +02:00
|
|
|
|
2025-03-02 16:28:57 +01:00
|
|
|
# directories
|
|
|
|
|
$hy_main_dir = '/etc/haproxy'
|
|
|
|
|
$hy_errors_dir = "${hy_main_dir}/errors"
|
2018-12-10 14:36:54 +01:00
|
|
|
|
2025-03-02 16:28:57 +01:00
|
|
|
# files
|
|
|
|
|
$hy_main_config = "${hy_main_dir}/haproxy.cfg"
|
|
|
|
|
$hy_config_head_erb = 'haproxy_cd/haproxy_head.erb'
|
|
|
|
|
$hy_config_tail_erb = 'haproxy_cd/haproxy_tail.erb'
|
|
|
|
|
$hy_400_file = "${hy_errors_dir}/400.http"
|
|
|
|
|
$hy_400_erb = 'haproxy_cd/errors/400_http.erb'
|
|
|
|
|
$hy_403_file = "${hy_errors_dir}/403.http"
|
|
|
|
|
$hy_403_erb = 'haproxy_cd/errors/403_http.erb'
|
|
|
|
|
$hy_408_file = "${hy_errors_dir}/408.http"
|
|
|
|
|
$hy_408_erb = 'haproxy_cd/errors/408_http.erb'
|
|
|
|
|
$hy_500_file = "${hy_errors_dir}/500.http"
|
|
|
|
|
$hy_500_erb = 'haproxy_cd/errors/500_http.erb'
|
|
|
|
|
$hy_502_file = "${hy_errors_dir}/502.http"
|
|
|
|
|
$hy_502_erb = 'haproxy_cd/errors/502_http.erb'
|
|
|
|
|
$hy_503_file = "${hy_errors_dir}/503.http"
|
|
|
|
|
$hy_503_erb = 'haproxy_cd/errors/503_http.erb'
|
|
|
|
|
$hy_504_file = "${hy_errors_dir}/504.http"
|
|
|
|
|
$hy_504_erb = 'haproxy_cd/errors/504_http.erb'
|
2018-04-24 17:07:38 +02:00
|
|
|
|
2025-03-02 16:28:57 +01:00
|
|
|
# includes must be last
|
|
|
|
|
include haproxy_cd::main::config
|
2018-04-24 15:32:11 +02:00
|
|
|
}
|