From 9789fdcd7d208ab24b22e040ef856576698451be Mon Sep 17 00:00:00 2001
From: Steve Lewis <stevelle@gmail.com>
Date: Fri, 5 Jun 2015 12:57:28 -0700
Subject: [PATCH] Configure DB addresses for each service

To enable partitioning of DB traffic by-service, each service needs to
use a custom connection string. Defaulting the service address to a
common galera_address makes things continue to work by default.

While the galera_address could be overridden on a container or host
basis this requires repeating that behavior across each infra node in
the inventory. Providing service-specific connection address variables
simplifies the management somewhat for large deployments and may reduce
error rates.

The service install playbooks now default the service-specific variables
instead of galera_address to the internal lb vip from inventory to
maintain the ease-of-use currently available.

Any value for a service-specific variable set in user_variables.yml will
override the value in the playbook's vars to provide selective
customization as needed.

Change-Id: I4c98bf906a0c1cb11ddd41277a855dce22ff646a
Closes-Bug: 1462529
---
 README.rst                        | 2 +-
 tasks/glance_db_setup.yml         | 4 ++--
 templates/glance-api.conf.j2      | 2 +-
 templates/glance-manage.conf.j2   | 2 +-
 templates/glance-registry.conf.j2 | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README.rst b/README.rst
index b740f7ee..b6bca912 100644
--- a/README.rst
+++ b/README.rst
@@ -19,4 +19,4 @@ This role will install the following:
       vars:
         external_lb_vip_address: 172.16.24.1
         internal_lb_vip_address: 192.168.0.1
-        galera_address: "{{ internal_lb_vip_address }}"
+        glance_galera_address: "{{ internal_lb_vip_address }}"
diff --git a/tasks/glance_db_setup.yml b/tasks/glance_db_setup.yml
index c5a67590..bf223773 100644
--- a/tasks/glance_db_setup.yml
+++ b/tasks/glance_db_setup.yml
@@ -17,7 +17,7 @@
   mysql_db:
     login_user: "{{ galera_root_user }}"
     login_password: "{{ galera_root_password }}"
-    login_host: "{{ galera_address }}"
+    login_host: "{{ glance_galera_address }}"
     name: "{{ glance_galera_database }}"
     state: "present"
   tags:
@@ -27,7 +27,7 @@
   mysql_user:
     login_user: "{{ galera_root_user }}"
     login_password: "{{ galera_root_password }}"
-    login_host: "{{ galera_address }}"
+    login_host: "{{ glance_galera_address }}"
     name: "{{ glance_galera_user }}"
     password: "{{ glance_container_mysql_password }}"
     host: "{{ item }}"
diff --git a/templates/glance-api.conf.j2 b/templates/glance-api.conf.j2
index 7594b10f..4f85c69c 100644
--- a/templates/glance-api.conf.j2
+++ b/templates/glance-api.conf.j2
@@ -48,7 +48,7 @@ image_cache_dir = {{ glance_system_user_home }}/cache/
 task_executor = {{ glance_task_executor }}
 
 [database]
-connection = mysql://{{ glance_galera_user }}:{{ glance_container_mysql_password }}@{{ galera_address }}/{{ glance_galera_database }}?charset=utf8
+connection = mysql://{{ glance_galera_user }}:{{ glance_container_mysql_password }}@{{ glance_galera_address }}/{{ glance_galera_database }}?charset=utf8
 
 [keystone_authtoken]
 auth_plugin = {{ glance_keystone_auth_plugin }}
diff --git a/templates/glance-manage.conf.j2 b/templates/glance-manage.conf.j2
index 33c5689e..19c6113b 100644
--- a/templates/glance-manage.conf.j2
+++ b/templates/glance-manage.conf.j2
@@ -6,4 +6,4 @@ fatal_deprecations = {{ glance_fatal_deprecations }}
 use_syslog = False
 
 [database]
-connection = mysql://{{ glance_galera_user }}:{{ glance_container_mysql_password }}@{{ galera_address }}/{{ glance_galera_database }}?charset=utf8
+connection = mysql://{{ glance_galera_user }}:{{ glance_container_mysql_password }}@{{ glance_galera_address }}/{{ glance_galera_database }}?charset=utf8
diff --git a/templates/glance-registry.conf.j2 b/templates/glance-registry.conf.j2
index fdc0a5ea..66ce65cb 100644
--- a/templates/glance-registry.conf.j2
+++ b/templates/glance-registry.conf.j2
@@ -18,7 +18,7 @@ api_limit_max = 1000
 limit_param_default = 25
 
 [database]
-connection = mysql://{{ glance_galera_user }}:{{ glance_container_mysql_password }}@{{ galera_address }}/{{ glance_galera_database }}?charset=utf8
+connection = mysql://{{ glance_galera_user }}:{{ glance_container_mysql_password }}@{{ glance_galera_address }}/{{ glance_galera_database }}?charset=utf8
 
 [keystone_authtoken]
 auth_plugin = {{ glance_keystone_auth_plugin }}