Files
confdroid_haproxy/manifests/params.pp

151 lines
7.4 KiB
ObjectPascal

## confdroid_haproxy::params.pp
# Module name: confdroid_haproxy
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @param [String] pkg_ensure
# which [package type](https://confdroid.com/2017/05/puppet-type-package/)
# to choose, i.e. `latest` or `present`.
# @param [array] reqpackages specify the packages to be installed
# @param [String] hy_host_fqdn the fqdn of the ha proxy host. must be fqdn,
# not cname. specify multiple fqdns via array.
# @param [Boolean] hy_manage_fw whether to manage the firewall.
# @param [String] hy_fw_order_no the rule number to control the order of the
# firewall rules.
# @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
# in emails sent from haproxy.
# @param [String] hy_user_home the home directory for the haproxy user.
# @param [String] hy_user_shell the shell for the haproxy user.
# @param [String] hy_log_target Where to send the logs for this haproxy.
# Currently only local logging / rsyslog forwarding supported.
# @param [String] hy_log_facility which logging facility to use.
# @param [String] hy_chroot where the chroot should be
# @param [String] hy_pid the pid file to use.
# @param [String] hy_maxconn how many connections should we max allow.
# @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
# @param [String] hy_log_default should be used when the instance's logging
# parameters are the same as the global ones.
# @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.
# @param [String] hy_timeout_http_keep_alive set the timeout value for
# keeping https connections alive
# @param [String] hy_timeout_check set the timeout value for how long to check
# 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
# @param [Boolean] hy_selinux_allow_stats whether to allow stats in selinux
# @param [String] hy_stats_port the port to use for stats. used in firewall settings
###############################################################################
class confdroid_haproxy::params (
String $pkg_ensure = 'latest',
Array $reqpackages = ['haproxy','httpd-tools'],
String $hy_host_fqdn = undef,
# firewall
Boolean $hy_manage_fw = true,
String $hy_fw_order_no = '50',
# fail2ban
Boolean $hy_manage_fail2ban = false,
# selinux
Boolean $hy_selinux_allow_stats = false,
# main config
String $hy_http_port = '80',
String $hy_https_port = '443',
String $hy_stats_port = '8404',
String $hy_chroot = '/var/lib/haproxy',
String $hy_pid = '/var/run/haproxy.pid',
String $hy_maxconn = '4000',
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',
# user
String $hy_user_name = 'haproxy',
String $hy_user_comment = 'haproxy user',
String $hy_user_home = '/var/lib/haproxy',
String $hy_user_shell = '/sbin/nologin',
# logging
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 = '####',
) {
$fqdn = $facts['networking']['fqdn']
# service
$hy_service = 'haproxy'
# directories
$hy_main_dir = '/etc/haproxy'
$hy_errors_dir = "${hy_main_dir}/errors"
$hy_certs_dir = "${hy_main_dir}/certs"
# files
$hy_main_config = "${hy_main_dir}/haproxy.cfg"
$hy_config_head_erb = 'confdroid_haproxy/haproxy_head.erb'
$hy_config_tail_erb = 'confdroid_haproxy/haproxy_tail.erb'
$hy_400_file = "${hy_errors_dir}/400.http"
$hy_400_erb = 'confdroid_haproxy/errors/400_http.erb'
$hy_403_file = "${hy_errors_dir}/403.http"
$hy_403_erb = 'confdroid_haproxy/errors/403_http.erb'
$hy_408_file = "${hy_errors_dir}/408.http"
$hy_408_erb = 'confdroid_haproxy/errors/408_http.erb'
$hy_500_file = "${hy_errors_dir}/500.http"
$hy_500_erb = 'confdroid_haproxy/errors/500_http.erb'
$hy_502_file = "${hy_errors_dir}/502.http"
$hy_502_erb = 'confdroid_haproxy/errors/502_http.erb'
$hy_503_file = "${hy_errors_dir}/503.http"
$hy_503_erb = 'confdroid_haproxy/errors/503_http.erb'
$hy_504_file = "${hy_errors_dir}/504.http"
$hy_504_erb = 'confdroid_haproxy/errors/504_http.erb'
# includes must be last
include confdroid_haproxy::main::config
}