Fix backend line syntax
authorYanis Guenane <yanis.guenane@enovance.com>
Wed, 1 Apr 2015 07:31:04 +0000 (09:31 +0200)
committerYanis Guenane <yanis.guenane@enovance.com>
Wed, 1 Apr 2015 09:02:25 +0000 (11:02 +0200)
Currently since only one node was the backend until this commit[1],
servername was deducted from the $::hostname fact. Since commit[1],
several node can be the backend for a service, so we need to provide
their servername also.

The current situation result with HAProxy refusing to start because
current lint look like

server  192.0.2.2:8776 check fall 5 inter 2000 rise 2

when they really should look like

server MYHOSTNAME  192.0.2.2:8776 check fall 5 inter 2000 rise 2

Resulting in error message : 'server' expects <name> and <addr>[:<port>]
as arguments.

[1] https://review.openstack.org/#/c/168044/

Change-Id: I75424cf02f2d24308f33105f67d82a8d411e372d

manifests/loadbalancer.pp

index 465bb58..1d60507 100644 (file)
 #  Defaults to undef
 #
 # [*controller_hosts*]
-#  Host or group of hosts to load-balance the services
+#  IPs of host or group of hosts to load-balance the services
+#  Can be a string or an array.
+#  Defaults to undef
+#
+# [*controller_hosts_names*]
+#  Names of host or group of hosts to load-balance the services
 #  Can be a string or an array.
 #  Defaults to undef
 #
@@ -132,6 +137,7 @@ class tripleo::loadbalancer (
   $public_virtual_ip,
   $controller_host           = undef,
   $controller_hosts          = undef,
+  $controller_hosts_names    = undef,
   $galera_master_hostname    = undef,
   $keystone_admin            = false,
   $keystone_public           = false,
@@ -163,6 +169,12 @@ class tripleo::loadbalancer (
     $controller_hosts_real = $controller_host
   }
 
+  if !$controller_hosts_names {
+    $controller_hosts_names_real = $controller_hosts_real
+  } else {
+    $controller_hosts_names_real = $controller_hosts_names
+  }
+
   case $::osfamily {
     'RedHat': {
       $keepalived_name_is_process = false
@@ -247,6 +259,7 @@ class tripleo::loadbalancer (
       listening_service => 'keystone_admin',
       ports             => '35357',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -264,6 +277,7 @@ class tripleo::loadbalancer (
       listening_service => 'keystone_public',
       ports             => '5000',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -281,6 +295,7 @@ class tripleo::loadbalancer (
       listening_service => 'neutron',
       ports             => '9696',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -298,6 +313,7 @@ class tripleo::loadbalancer (
       listening_service => 'cinder',
       ports             => '8776',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -315,6 +331,7 @@ class tripleo::loadbalancer (
       listening_service => 'glance_api',
       ports             => '9292',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -332,6 +349,7 @@ class tripleo::loadbalancer (
       listening_service => 'glance_registry',
       ports             => '9191',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -349,6 +367,7 @@ class tripleo::loadbalancer (
       listening_service => 'nova_ec2',
       ports             => '8773',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -366,6 +385,7 @@ class tripleo::loadbalancer (
       listening_service => 'nova_osapi',
       ports             => '8774',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -383,6 +403,7 @@ class tripleo::loadbalancer (
       listening_service => 'nova_metadata',
       ports             => '8775',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -400,6 +421,7 @@ class tripleo::loadbalancer (
       listening_service => 'nova_novncproxy',
       ports             => '6080',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -414,6 +436,7 @@ class tripleo::loadbalancer (
       listening_service => 'ceilometer',
       ports             => '8777',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => [],
     }
   }
@@ -431,6 +454,7 @@ class tripleo::loadbalancer (
       listening_service => 'swift_proxy_server',
       ports             => '8080',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -448,6 +472,7 @@ class tripleo::loadbalancer (
       listening_service => 'heat_api',
       ports             => '8004',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -465,6 +490,7 @@ class tripleo::loadbalancer (
       listening_service => 'heat_cloudwatch',
       ports             => '8003',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -482,6 +508,7 @@ class tripleo::loadbalancer (
       listening_service => 'heat_cfn',
       ports             => '8000',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -499,6 +526,7 @@ class tripleo::loadbalancer (
       listening_service => 'horizon',
       ports             => '80',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }
@@ -521,6 +549,7 @@ class tripleo::loadbalancer (
       listening_service => 'mysql',
       ports             => '3306',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => $options_real,
     }
   }
@@ -538,6 +567,7 @@ class tripleo::loadbalancer (
       listening_service => 'rabbitmq',
       ports             => '5672',
       ipaddresses       => $controller_hosts_real,
+      server_names      => $controller_hosts_names_real,
       options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
     }
   }