From e82fb956035a5a6a766f09ac8ea2a84841fac701 Mon Sep 17 00:00:00 2001
From: Joshua Harlow <jxharlow@godaddy.com>
Date: Tue, 27 Mar 2018 10:02:22 -0700
Subject: [PATCH] Make it possible to not haproxy memcached

Clients usually have sophisticated logic for handling
key redistribution on node failure; so going under the
covers and messing with that is bad (because then the
clients and their sophisticated logic is unaware of
what is going on).

Change-Id: Ica12240440d28f930b917d5d6202f4f9e6675b2a
---
 ansible/group_vars/all.yml                     | 6 ++++++
 ansible/roles/haproxy/templates/haproxy.cfg.j2 | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index f547cec0d7..ae011e8960 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -375,6 +375,12 @@ enable_nova: "yes"
 enable_rabbitmq: "{{ 'yes' if om_rpc_transport == 'rabbit' or om_notify_transport == 'rabbit' else 'no' }}"
 enable_outward_rabbitmq: "{{ enable_murano | bool }}"
 
+# Most memcache clients handle load-balancing via client side
+# hashing (consistent or not) logic, so going under the covers and messing
+# with things that the clients are not aware of is general wrong (but this
+# keeps the default as is...)
+enable_haproxy_memcached: "yes"
+
 # Additional optional OpenStack features and services are specified here
 enable_aodh: "no"
 enable_barbican: "no"
diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2
index 49d11bf7f1..93df88f700 100644
--- a/ansible/roles/haproxy/templates/haproxy.cfg.j2
+++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2
@@ -921,7 +921,7 @@ listen mariadb
 {% endfor %}
 {% endif %}
 
-{% if enable_memcached | bool %}
+{% if enable_memcached | bool and enable_haproxy_memcached | bool %}
 listen memcached
   mode tcp
   timeout client 3600s