Rename controller_host to controller_hosts
authorYanis Guenane <yanis.guenane@enovance.com>
Tue, 31 Mar 2015 08:35:18 +0000 (10:35 +0200)
committerYanis Guenane <yanis.guenane@enovance.com>
Tue, 31 Mar 2015 13:47:32 +0000 (15:47 +0200)
Since we can have many controller_hosts backend in a setup, we use the
plural term to define it.

Change-Id: I2a46c250bc3325eef9c3128cac2ab45c88b1ae75

manifests/loadbalancer.pp

index 331c892..465bb58 100644 (file)
 # === Parameters:
 #
 # [*controller_host*]
+#  (Deprecated)Host or group of hosts to load-balance the services
+#  Can be a string or an array.
+#  Defaults to undef
+#
+# [*controller_hosts*]
 #  Host or group of hosts to load-balance the services
 #  Can be a string or an array.
 #  Defaults to undef
 #  Defaults to false
 #
 class tripleo::loadbalancer (
-  $controller_host,
   $controller_virtual_ip,
   $control_virtual_interface,
   $public_virtual_interface,
   $public_virtual_ip,
+  $controller_host           = undef,
+  $controller_hosts          = undef,
   $galera_master_hostname    = undef,
   $keystone_admin            = false,
   $keystone_public           = false,
@@ -147,6 +153,16 @@ class tripleo::loadbalancer (
   $rabbitmq                  = false,
 ) {
 
+  if !$controller_host and !$controller_hosts {
+    fail('$controller_hosts or $controller_host (now deprecated) is a mandatory parameter')
+  }
+  if $controller_hosts {
+    $controller_hosts_real = $controller_hosts
+  } else {
+    warning('$controller_host has been deprecated in favor of $controller_hosts')
+    $controller_hosts_real = $controller_host
+  }
+
   case $::osfamily {
     'RedHat': {
       $keepalived_name_is_process = false
@@ -230,7 +246,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'keystone_admin':
       listening_service => 'keystone_admin',
       ports             => '35357',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -247,7 +263,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'keystone_public':
       listening_service => 'keystone_public',
       ports             => '5000',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -264,7 +280,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'neutron':
       listening_service => 'neutron',
       ports             => '9696',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -281,7 +297,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'cinder':
       listening_service => 'cinder',
       ports             => '8776',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -298,7 +314,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'glance_api':
       listening_service => 'glance_api',
       ports             => '9292',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -315,7 +331,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'glance_registry':
       listening_service => 'glance_registry',
       ports             => '9191',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -332,7 +348,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'nova_ec2':
       listening_service => 'nova_ec2',
       ports             => '8773',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -349,7 +365,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'nova_osapi':
       listening_service => 'nova_osapi',
       ports             => '8774',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -366,7 +382,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'nova_metadata':
       listening_service => 'nova_metadata',
       ports             => '8775',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -383,7 +399,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'nova_novncproxy':
       listening_service => 'nova_novncproxy',
       ports             => '6080',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -397,7 +413,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'ceilometer':
       listening_service => 'ceilometer',
       ports             => '8777',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => [],
     }
   }
@@ -414,7 +430,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'swift_proxy_server':
       listening_service => 'swift_proxy_server',
       ports             => '8080',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -431,7 +447,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'heat_api':
       listening_service => 'heat_api',
       ports             => '8004',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -448,7 +464,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'heat_cloudwatch':
       listening_service => 'heat_cloudwatch',
       ports             => '8003',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -465,7 +481,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'heat_cfn':
       listening_service => 'heat_cfn',
       ports             => '8000',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -482,7 +498,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'horizon':
       listening_service => 'horizon',
       ports             => '80',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -504,7 +520,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'mysql':
       listening_service => 'mysql',
       ports             => '3306',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => $options_real,
     }
   }
@@ -521,7 +537,7 @@ class tripleo::loadbalancer (
     haproxy::balancermember { 'rabbitmq':
       listening_service => 'rabbitmq',
       ports             => '5672',
-      ipaddresses       => $controller_host,
+      ipaddresses       => $controller_hosts_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }