loadbalancer: fix define function (refs: #4541)

This commit is contained in:
Sebastien Badia 2013-12-30 12:36:26 +01:00
parent b3b9ebe22e
commit 6a196dde7e
2 changed files with 52 additions and 33 deletions

View File

@ -161,66 +161,48 @@ monitor fail if horizon_dead
}
}
define os_haproxy_listen_http( $ports ) {
if $name == '6082' { # spice doesn't support OPTIONS
$httpchk = 'httpchk GET /'
} else {
$httpchk = 'httpchk'
}
haproxy::listen { $name:
ipaddress => '0.0.0.0',
ports => $ports,
options => {
'mode' => 'http',
'balance' => 'roundrobin',
'option' => ['tcpka', 'tcplog', $httpchk],
'http-check' => 'expect ! rstatus ^5',
}
}
}
if $keystone {
os_haproxy_listen_http { 'keystone_api_cluster': ports => $ks_keystone_public_port }
os_haproxy_listen_http { 'keystone_api_admin_cluster': ports => $ks_keystone_admin_port }
privatecloud::loadbalancer::listen_http { 'keystone_api_cluster': ports => $ks_keystone_public_port }
privatecloud::loadbalancer::listen_http { 'keystone_api_admin_cluster': ports => $ks_keystone_admin_port }
}
if $swift_api {
os_haproxy_listen_http{ 'swift_api_cluster': ports => $ks_swift_public_port, httpchk => 'httpchk /healthcheck' }
privatecloud::loadbalancer::listen_http{ 'swift_api_cluster': ports => $ks_swift_public_port, httpchk => 'httpchk /healthcheck' }
}
if $nova_api {
os_haproxy_listen_http{ 'nova_api_cluster': ports => $ks_nova_public_port }
privatecloud::loadbalancer::listen_http{ 'nova_api_cluster': ports => $ks_nova_public_port }
}
if $ec2_api {
os_haproxy_listen_http{ 'ec2_api_cluster': ports => $ks_ec2_public_port }
privatecloud::loadbalancer::listen_http{ 'ec2_api_cluster': ports => $ks_ec2_public_port }
}
if $metadata_api {
os_haproxy_listen_http{ 'metadata_api_cluster': ports => $ks_metadata_public_port }
privatecloud::loadbalancer::listen_http{ 'metadata_api_cluster': ports => $ks_metadata_public_port }
}
if $spice {
os_haproxy_listen_http{ 'spice_cluster': ports => $spice_port }
privatecloud::loadbalancer::listen_http{ 'spice_cluster': ports => $spice_port }
}
if $glance_api {
os_haproxy_listen_http{ 'spice_cluster': ports => $ks_glance_public_port }
privatecloud::loadbalancer::listen_http{ 'spice_cluster': ports => $ks_glance_public_port }
}
if $neutron_api {
os_haproxy_listen_http{ 'neutron_api_cluster': ports => $ks_neutron_public_port }
privatecloud::loadbalancer::listen_http{ 'neutron_api_cluster': ports => $ks_neutron_public_port }
}
if $cinder_api {
os_haproxy_listen_http{ 'cinder_api_cluster': ports => $ks_cinder_public_port }
privatecloud::loadbalancer::listen_http{ 'cinder_api_cluster': ports => $ks_cinder_public_port }
}
if $ceilometer_api {
os_haproxy_listen_http{ 'ceilometer_api_cluster': ports => $ks_ceilometer_public_port }
privatecloud::loadbalancer::listen_http{ 'ceilometer_api_cluster': ports => $ks_ceilometer_public_port }
}
if $heat_api {
os_haproxy_listen_http{ 'heat_api_cluster': ports => $ks_heat_public_port }
privatecloud::loadbalancer::listen_http{ 'heat_api_cluster': ports => $ks_heat_public_port }
}
if $heat_cfn_api {
os_haproxy_listen_http{ 'heat_api_cfn_cluster': ports => $ks_heat_cfn_public_port }
privatecloud::loadbalancer::listen_http{ 'heat_api_cfn_cluster': ports => $ks_heat_cfn_public_port }
}
if $heat_cloudwatch_api {
os_haproxy_listen_http{ 'heat_api_cloudwatch_cluster': ports => $ks_heat_cloudwatch_public_port }
privatecloud::loadbalancer::listen_http{ 'heat_api_cloudwatch_cluster': ports => $ks_heat_cloudwatch_public_port }
}
if $horizon {
os_haproxy_listen_http{ 'horizon_cluster': ports => $horizon_port }
privatecloud::loadbalancer::listen_http{ 'horizon_cluster': ports => $horizon_port }
}
haproxy::listen { 'galera_cluster':

View File

@ -0,0 +1,37 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Define::
#
# privatecloud::loadbalancer::listen_http
#
define privatecloud::loadbalancer::listen_http( $ports = 'unset' ) {
if $name == '6082' { # spice doesn't support OPTIONS
$httpchk = 'httpchk GET /'
} else {
$httpchk = 'httpchk'
}
haproxy::listen { $name:
ipaddress => '0.0.0.0',
ports => $ports,
options => {
'mode' => 'http',
'balance' => 'roundrobin',
'option' => ['tcpka', 'tcplog', $httpchk],
'http-check' => 'expect ! rstatus ^5',
}
}
}