From 0ae6b5cad2590a05dc3ee7830a21cdbdef52e4f7 Mon Sep 17 00:00:00 2001 From: David Grier Date: Thu, 7 Nov 2019 15:57:49 +0000 Subject: [PATCH] added hostvar logic for cluster int --- .../confluent-community-broker/templates/consumer.properties | 2 +- .../templates/kafka-rest.properties | 2 +- .../templates/ksql-server.properties | 2 +- .../confluent-community-broker/templates/producer.properties | 2 +- .../confluent-community-broker/templates/server.properties | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/playbooks/roles/confluent-community-broker/templates/consumer.properties b/playbooks/roles/confluent-community-broker/templates/consumer.properties index 49b0f64..5e87533 100644 --- a/playbooks/roles/confluent-community-broker/templates/consumer.properties +++ b/playbooks/roles/confluent-community-broker/templates/consumer.properties @@ -16,7 +16,7 @@ # list of brokers used for bootstrapping knowledge about the rest of the cluster # format: host1:port1,host2:port2 ... -bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ node }}:9092{% if not loop.last %},{% endif %}{% endfor %} +bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ hostvars[node]['ansible_'~hostvars[node].cluster_interface|default(hostvars[node].ansible_default_ipv4.alias)]['ipv4']['address'] }}:9092{% if not loop.last %},{% endif %}{% endfor %} # consumer group id group.id=test-consumer-group diff --git a/playbooks/roles/confluent-community-broker/templates/kafka-rest.properties b/playbooks/roles/confluent-community-broker/templates/kafka-rest.properties index 8305475..37036f6 100644 --- a/playbooks/roles/confluent-community-broker/templates/kafka-rest.properties +++ b/playbooks/roles/confluent-community-broker/templates/kafka-rest.properties @@ -1,5 +1,5 @@ # Maintained by Ansible #bootstrap.servers=104.130.220.120:9092,104.130.220.119:9092,104.130.220.122:9092 -bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ node }}:9092{% if not loop.last %},{% endif %}{% endfor %} +bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ hostvars[node]['ansible_'~hostvars[node].cluster_interface|default(hostvars[node].ansible_default_ipv4.alias)]['ipv4']['address'] }}:9092{% if not loop.last %},{% endif %}{% endfor %} listeners=http://0.0.0.0:8082 client.ssl.endpoint.identification.algorithm= diff --git a/playbooks/roles/confluent-community-broker/templates/ksql-server.properties b/playbooks/roles/confluent-community-broker/templates/ksql-server.properties index b98c07c..0a2fd87 100644 --- a/playbooks/roles/confluent-community-broker/templates/ksql-server.properties +++ b/playbooks/roles/confluent-community-broker/templates/ksql-server.properties @@ -1,7 +1,7 @@ # Maintained by Ansible #bootstrap.servers=104.130.220.120:9092,104.130.220.119:9092,104.130.220.122:9092 -bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ node }}:9092{% if not loop.last %},{% endif %}{% endfor %} +bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ hostvars[node]['ansible_'~hostvars[node].cluster_interface|default(hostvars[node].ansible_default_ipv4.alias)]['ipv4']['address'] }}:9092{% if not loop.last %},{% endif %}{% endfor %} #ksql.schema.registry.url=http://104.130.220.122:8081/ ksql.schema.registry.url=http://{{ hostvars[groups['kafka-ksql-schema-node'][0]][['ansible_', hostvars[groups['kafka-ksql-schema-node'][0]]['cluster_interface']]|join]['ipv4']['address'] }}:8081/ diff --git a/playbooks/roles/confluent-community-broker/templates/producer.properties b/playbooks/roles/confluent-community-broker/templates/producer.properties index c5383cf..08ade13 100644 --- a/playbooks/roles/confluent-community-broker/templates/producer.properties +++ b/playbooks/roles/confluent-community-broker/templates/producer.properties @@ -18,7 +18,7 @@ # list of brokers used for bootstrapping knowledge about the rest of the cluster # format: host1:port1,host2:port2 ... -bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ node }}:9092{% if not loop.last %},{% endif %}{% endfor %} +bootstrap.servers={% for node in groups['kafka-server-nodes'] %}{{ hostvars[node]['ansible_'~hostvars[node].cluster_interface|default(hostvars[node].ansible_default_ipv4.alias)]['ipv4']['address'] }}:9092{% if not loop.last %},{% endif %}{% endfor %} # specify the compression codec for all data generated: none, gzip, snappy, lz4, zstd compression.type=none diff --git a/playbooks/roles/confluent-community-broker/templates/server.properties b/playbooks/roles/confluent-community-broker/templates/server.properties index 045769b..624f6e1 100644 --- a/playbooks/roles/confluent-community-broker/templates/server.properties +++ b/playbooks/roles/confluent-community-broker/templates/server.properties @@ -6,10 +6,10 @@ listeners=PLAINTEXT://:9092 #listeners={{ hostvars[node]['ansible_'~hostvars[node].cluster_interface|default(hostvars[node].ansible_default_ipv4.alias)]['ipv4']['address'] }}:2888:3888 #{% endfor %} -listeners={% for node in groups['kafka-server-nodes'] %}{{ node }}:9092{% if not loop.last %},{% endif %}{% endfor %} +listeners={% for node in groups['kafka-server-nodes'] %}{{ hostvars[node]['ansible_'~hostvars[node].cluster_interface|default(hostvars[node].ansible_default_ipv4.alias)]['ipv4']['address'] }}:9092{% if not loop.last %},{% endif %}{% endfor %} #zookeeper.connect=104.130.220.120:2181,104.130.220.119:2181,104.130.220.122:2181 -zookeeper.connect={% for node in groups['kafka-zk-nodes'] %}{{ node }}:2181{% if not loop.last %},{% endif %}{% endfor %} +zookeeper.connect={% for node in groups['kafka-zk-nodes'] %}{{ hostvars[node]['ansible_'~hostvars[node].cluster_interface|default(hostvars[node].ansible_default_ipv4.alias)]['ipv4']['address'] }}:2181{% if not loop.last %},{% endif %}{% endfor %} log.dirs=/kafka/data change to proper mount