From f2ef8aaf1ba225ad0fdc89848918dc905308a577 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Mon, 4 May 2015 13:22:35 +0200 Subject: [PATCH] Update tripleo to a388f84654701f5d6604e0833a6a8fe1b90fcfdd a388f84654701f5d6604e0833a6a8fe1b90fcfdd Merge "Make setup of keepalived optional via manage_vip parameter" a3d93790c284863d9b4bc32eae8dd35c6e6cb68c Merge "Bump rspec-puppet to 2.1.0" d6405961b49147499574d7ceea3f57c0f48d06f9 Bump rspec-puppet to 2.1.0 20fad5ae9117f529fdc5e0ad15aca78c6a3a59f7 Merge "Enable access to HAProxy stats page" 93b309b2f3b897e1b55634f576706f81b8ccb2e1 Merge "Add $::galera_bootstrapped fact" ec7667b43c4d8dd5fb8222c3ddd9572e08477390 Merge "Do not make RabbitMQ listen on public vip" 70cb73ca6e53cbca3a841a67d2bb1644461754c6 Do not make RabbitMQ listen on public vip 8c29315cbcd5e255e1287e86cd8134590b9e7d06 Make setup of keepalived optional via manage_vip parameter dfcb703bce19c8cc9113c294295de977c51c8e7c Enable access to HAProxy stats page 9ad337d15e7e3305c0872aee231f75e7af55e889 Add $::galera_bootstrapped fact Change-Id: Ia4e32678ad7e5e58e92384e942d41e68561d07d0 --- Puppetfile | 2 +- tripleo/Gemfile | 2 +- tripleo/lib/facter/galera_bootstrapped.rb | 19 +++++ tripleo/manifests/loadbalancer.pp | 87 ++++++++++++----------- 4 files changed, 68 insertions(+), 42 deletions(-) create mode 100644 tripleo/lib/facter/galera_bootstrapped.rb diff --git a/Puppetfile b/Puppetfile index 93bf0376d..4f195213a 100644 --- a/Puppetfile +++ b/Puppetfile @@ -207,7 +207,7 @@ mod 'timezone', :git => 'https://github.com/saz/puppet-timezone.git' mod 'tripleo', - :commit => 'e0921709d946d8db95f2a399a1b9da93d6b73d06', + :commit => 'a388f84654701f5d6604e0833a6a8fe1b90fcfdd', :git => 'https://github.com/stackforge/puppet-tripleo.git' mod 'trove', diff --git a/tripleo/Gemfile b/tripleo/Gemfile index 3800d2ecc..10b37ac52 100644 --- a/tripleo/Gemfile +++ b/tripleo/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', '~> 2.0.0', :require => false + gem 'rspec-puppet', '~> 2.1.0', :require => false gem 'metadata-json-lint' gem 'puppet-lint-param-docs' diff --git a/tripleo/lib/facter/galera_bootstrapped.rb b/tripleo/lib/facter/galera_bootstrapped.rb new file mode 100644 index 000000000..ea9fe8cf6 --- /dev/null +++ b/tripleo/lib/facter/galera_bootstrapped.rb @@ -0,0 +1,19 @@ +# Copyright 2015 Red Hat, Inc. +# All Rights Reserved. +# +# 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. +Facter.add('galera_bootstrapped') do + setcode do + FileTest.exists?('/var/lib/mysql/grastate.dat') + end +end diff --git a/tripleo/manifests/loadbalancer.pp b/tripleo/manifests/loadbalancer.pp index 6601cf92a..6b5999ac6 100644 --- a/tripleo/manifests/loadbalancer.pp +++ b/tripleo/manifests/loadbalancer.pp @@ -19,6 +19,10 @@ # # === Parameters: # +# [*manage_vip*] +# Whether to enable keepalived to manage the VIPs or not +# Defaults to true +# # [*controller_host*] # (Deprecated)Host or group of hosts to load-balance the services # Can be a string or an array. @@ -143,6 +147,7 @@ $control_virtual_interface, $public_virtual_interface, $public_virtual_ip, + $manage_vip = true, $controller_host = undef, $controller_hosts = undef, $controller_hosts_names = undef, @@ -185,46 +190,48 @@ $controller_hosts_names_real = $controller_hosts_names } - case $::osfamily { - 'RedHat': { - $keepalived_name_is_process = false - $keepalived_vrrp_script = 'systemctl status haproxy.service' - } # RedHat - 'Debian': { - $keepalived_name_is_process = true - $keepalived_vrrp_script = undef - } - default: { - warning('Please configure keepalived defaults in tripleo::loadbalancer.') - $keepalived_name_is_process = undef - $keepalived_vrrp_script = undef + if $manage_vip { + case $::osfamily { + 'RedHat': { + $keepalived_name_is_process = false + $keepalived_vrrp_script = 'systemctl status haproxy.service' + } # RedHat + 'Debian': { + $keepalived_name_is_process = true + $keepalived_vrrp_script = undef + } + default: { + warning('Please configure keepalived defaults in tripleo::loadbalancer.') + $keepalived_name_is_process = undef + $keepalived_vrrp_script = undef + } + } + + class { '::keepalived': } + keepalived::vrrp_script { 'haproxy': + name_is_process => $keepalived_name_is_process, + script => $keepalived_vrrp_script, + } + + # KEEPALIVE INSTANCE CONTROL + keepalived::instance { '51': + interface => $control_virtual_interface, + virtual_ips => [join([$controller_virtual_ip, ' dev ', $control_virtual_interface])], + state => 'MASTER', + track_script => ['haproxy'], + priority => 101, + } + + # KEEPALIVE INSTANCE PUBLIC + keepalived::instance { '52': + interface => $public_virtual_interface, + virtual_ips => [join([$public_virtual_ip, ' dev ', $public_virtual_interface])], + state => 'MASTER', + track_script => ['haproxy'], + priority => 101, } } - class { '::keepalived': } - keepalived::vrrp_script { 'haproxy': - name_is_process => $keepalived_name_is_process, - script => $keepalived_vrrp_script, - } - - # KEEPALIVE INSTANCE CONTROL - keepalived::instance { '51': - interface => $control_virtual_interface, - virtual_ips => [join([$controller_virtual_ip, ' dev ', $control_virtual_interface])], - state => 'MASTER', - track_script => ['haproxy'], - priority => 101, - } - - # KEEPALIVE INSTANCE PUBLIC - keepalived::instance { '52': - interface => $public_virtual_interface, - virtual_ips => [join([$public_virtual_ip, ' dev ', $public_virtual_interface])], - state => 'MASTER', - track_script => ['haproxy'], - priority => 101, - } - sysctl::value { 'net.ipv4.ip_nonlocal_bind': value => '1' } class { '::haproxy': @@ -247,11 +254,11 @@ } haproxy::listen { 'haproxy.stats': - ipaddress => '*', + ipaddress => $controller_virtual_ip, ports => '1993', mode => 'http', options => { - 'stats' => 'enable', + 'stats' => ['enable', 'uri /'], }, collect_exported => false, } @@ -572,7 +579,7 @@ if $rabbitmq { haproxy::listen { 'rabbitmq': - ipaddress => [$controller_virtual_ip, $public_virtual_ip], + ipaddress => [$controller_virtual_ip], ports => 5672, options => { 'timeout' => [ 'client 0', 'server 0' ],