From 71b0526a446b061b4f469f191d80ce89eb262c25 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 27 Apr 2021 10:16:08 -0700 Subject: [PATCH] Fix the zk peer listing to match myid values We were using a loop index which meant for our cluster size of three we would always assign server.1 through server.3. Unfortunately, as we replace servers we may add notes with a myid value >3 which breaks when we try to assign serverids in this way. Fix it by using the calculation for myid in the peer listing. Change-Id: Icf770c75cf3a84420116f47ad691d9f06191fb65 --- playbooks/roles/zookeeper/templates/zoo.cfg.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/roles/zookeeper/templates/zoo.cfg.j2 b/playbooks/roles/zookeeper/templates/zoo.cfg.j2 index a5590d8017..8ca9db5b63 100644 --- a/playbooks/roles/zookeeper/templates/zoo.cfg.j2 +++ b/playbooks/roles/zookeeper/templates/zoo.cfg.j2 @@ -28,7 +28,7 @@ secureClientPort=2281 ssl.keyStore.location=/tls/keys/keystore.pem ssl.trustStore.location=/tls/certs/cacert.pem {% for host in groups['zookeeper'] %} -server.{{ loop.index }}={{ (hostvars[host].public_v4) }}:2888:3888 +server.{{ host | regex_replace('^zk(\\d+)\\.open.*\\.org$', '\\1') | int }}={{ (hostvars[host].public_v4) }}:2888:3888 {% endfor %} sslQuorum=true serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory