# configure a haproxy server class profiles::haproxy::server ( Hash $globals = {}, Hash $defaults = {}, ){ # default global/defaults arrays $global_options = { 'log' => "${facts['networking']['ip']} local0", 'chroot' => '/var/lib/haproxy', 'pidfile' => '/var/run/haproxy.pid', 'maxconn' => '4000', 'user' => 'haproxy', 'group' => 'haproxy', 'daemon' => '', 'stats' => 'socket /var/lib/haproxy/stats', } $default_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', } # merge the default globals/defaults with those provided as params $merged_global_options = merge($global_options, $globals) $merged_default_options = merge($default_options, $defaults) # wait until enc_role matches haproxy enc_role if $facts['enc_role'] == 'roles::infra::halb::haproxy' { # manage selinux include profiles::haproxy::selinux # create the haproxy service/instance class { 'haproxy': global_options => $merged_global_options, defaults_options => $merged_default_options, require => Class['profiles::haproxy::selinux'] } include profiles::haproxy::certlist # manage the certificate list file include profiles::haproxy::mappings # manage the domain to backend mappings include profiles::haproxy::ls_stats # default status listener include profiles::haproxy::dns # manage dns for haproxy include profiles::haproxy::frontends # create frontends include profiles::haproxy::backends # create backends include profiles::haproxy::listeners # create listeners include prometheus::haproxy_exporter # generate metrics Class['profiles::haproxy::certlist'] -> Class['profiles::haproxy::dns'] -> Class['profiles::haproxy::mappings'] } }