diff --git a/manifests/main/files.pp b/manifests/main/files.pp index a64bd10..3715e5d 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -45,5 +45,17 @@ class cd_haproxy::main::files ( content => template($hy_config_head_erb), order => '001', } + + # pid file + file { $hy_pid: + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + selrange => s0, + selrole => object_r, + seltype => haproxy_var_run_t, + seluser => system_u, + } } } diff --git a/manifests/params.pp b/manifests/params.pp index 417285f..fb2ebe7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -34,7 +34,16 @@ # @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_shell the shell for the haproxy user. +# @param [string] hy_user_home the home directory for the haprxy 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 [boolean] hy_show_stats whether we want to display the statistics page +# @param [string] hy_stats_socket name and path of the stats socket ############################################################################### class cd_haproxy::params ( @@ -57,6 +66,15 @@ $hy_user_comment = 'haproxy user', $hy_user_home = '/var/lib/haproxy', $hy_user_shell = '/sbin/nologin', +# logging +$hy_log_target = '127.0.0.1', +$hy_log_facility = 'local2', +$hy_chroot = '/var/lib/haproxy', +$hy_pid = '/var/run/haproxy.pid', +$hy_maxconn = '4000', +$hy_show_stats = true, +$hy_stats_socket = '/var/lib/haproxy/stats', + ) { # service diff --git a/templates/haproxy_head.erb b/templates/haproxy_head.erb index b406761..ffd7c33 100644 --- a/templates/haproxy_head.erb +++ b/templates/haproxy_head.erb @@ -3,3 +3,17 @@ ##### will be overwritten. original full file available at ##### ##### https://confdroid.com/2018/12/haproxy-cfg/ ##### ############################################################################### + +global + log <%= @hy_log_target %> <%= @hy_log_facility %> + + chroot <%= @hy_chroot %> + pidfile <%= @hy_pid %> + maxconn <%= @hy_maxconn %> + user <%= @hy_user_name %> + group <%= @hy_user_name %> + daemon + +<% if @hy_show_stats == true -%> + stats socket <%= @hy_stats_socket %> +<% end -%>