Defined Type: profile::openstack::base::haproxy::site

Defined in:
modules/profile/manifests/openstack/base/haproxy/site.pp

Overview

healthcheck_options

Array of Strings A list of healthcheck (http-check) options

Examples

profile::openstack::base::haproxy::site { 'nova_metadata':
    port_frontend => '8775',
    port_backend  => '18775',
    servers       => ['backend-host01', 'backend-host02'],
}

Parameters:

  • servers (Array[Stdlib::Fqdn])
  • port_backend (Stdlib::Port)
  • port_frontend (Stdlib::Port)
  • primary_host (Optional[Stdlib::Fqdn]) (defaults to: undef)
  • healthcheck_path (Stdlib::Compat::String) (defaults to: '')
  • healthcheck_method (String) (defaults to: '')
  • healthcheck_options (Array[String]) (defaults to: [])
  • ensure (Wmflib::Ensure) (defaults to: present)
  • type (Enum['http', 'tcp']) (defaults to: 'http')


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'modules/profile/manifests/openstack/base/haproxy/site.pp', line 49

define profile::openstack::base::haproxy::site(
    Array[Stdlib::Fqdn] $servers,
    Stdlib::Port $port_backend,
    Stdlib::Port $port_frontend,
    Optional[Stdlib::Fqdn] $primary_host = undef,
    Stdlib::Compat::String $healthcheck_path = '',
    String $healthcheck_method = '',
    Array[String] $healthcheck_options = [],
    Wmflib::Ensure $ensure = present,
    Enum['http', 'tcp'] $type = 'http',
) {
    include profile::openstack::base::haproxy

    # If the host's FQDN is in $servers configure FERM to allow peer
    # connections on the backend service port.
    if $::fqdn in $servers {
        # Allow traffic to peers on backend ports
        $peers = join(delete($servers, $::fqdn), ' ')
        ferm::service { "${title}_haproxy_backend":
            proto  => 'tcp',
            port   => $port_backend,
            srange => "(@resolve((${peers})) @resolve((${peers}), AAAA))",
        }
    }

    if $type == 'http' {
        file { "/etc/haproxy/conf.d/${title}.cfg":
            ensure  => $ensure,
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => template('profile/openstack/base/haproxy/conf.d/http-service.cfg.erb'),
            # restart to pick up new config files in conf.d
            notify  => Exec['restart-haproxy'],
        }
    } elsif $type == 'tcp' {
        file { "/etc/haproxy/conf.d/${title}.cfg":
            ensure  => $ensure,
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => template('profile/openstack/base/haproxy/conf.d/tcp-service.cfg.erb'),
            # restart to pick up new config files in conf.d
            notify  => Exec['restart-haproxy'],
        }
    } else {
        fail("Unknown service type ${type}")
    }
}