New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

messaging: Add new modules for kafka-topics #29011

Open
wants to merge 12 commits into
base: devel
from

Conversation

Projects
None yet
9 participants
@gdelpierre
Contributor

gdelpierre commented Sep 5, 2017

SUMMARY

This module aims to allow a user to manage Kafka topics

Internally it relies on kafka scripts (kafka-topics.sh).

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME
  • kafka_topics.py
ANSIBLE VERSION
ansible 2.3.1.0
  config file = /home/gdelpierre/devel/roles/ansible.cfg
  configured module search path = [u'./library/']
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]
@gdelpierre

This comment has been minimized.

Contributor

gdelpierre commented Sep 5, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Sep 5, 2017

The test ansible-test sanity --test boilerplate [?] failed with the following error:

Command "test/sanity/code-smell/boilerplate.sh" returned exit status 2.
>>> Standard Output
== Missing __metaclass__ = type ==
./lib/ansible/modules/messaging/kafka_topics.py

== Missing from __future__ import (absolute_import, division, print_function) ==
./lib/ansible/modules/messaging/kafka_topics.py

The test ansible-test sanity --test no-dict-iteritems [?] failed with the following error:

Command "test/sanity/code-smell/no-dict-iteritems.sh" returned exit status 1.
>>> Standard Output
iteritems has been removed in python3.  Alternatives:
    for KEY, VALUE in DICT.items():
    from ansible.module_utils.six import iteritems ; for KEY, VALUE in iteritems(DICT):
./lib/ansible/modules/messaging/kafka_topics.py:                    "%s=%r" % (key, value) for (key, value) in self.config.iteritems())

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/messaging/kafka_topics.py:41:66: W291 trailing whitespace
lib/ansible/modules/messaging/kafka_topics.py:135:161: E501 line too long (231 > 160 characters)
lib/ansible/modules/messaging/kafka_topics.py:150:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/messaging/kafka_topics.py:153:1: W293 blank line contains whitespace
lib/ansible/modules/messaging/kafka_topics.py:154:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/messaging/kafka_topics.py:162:23: E221 multiple spaces before operator
lib/ansible/modules/messaging/kafka_topics.py:229:21: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:237:24: E201 whitespace after '{'
lib/ansible/modules/messaging/kafka_topics.py:237:58: E202 whitespace before '}'
lib/ansible/modules/messaging/kafka_topics.py:242:24: E225 missing whitespace around operator
lib/ansible/modules/messaging/kafka_topics.py:264:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:274:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:284:24: E201 whitespace after '{'
lib/ansible/modules/messaging/kafka_topics.py:284:58: E202 whitespace before '}'
lib/ansible/modules/messaging/kafka_topics.py:300:21: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:301:51: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:302:51: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:307:24: E201 whitespace after '{'
lib/ansible/modules/messaging/kafka_topics.py:307:58: E202 whitespace before '}'
lib/ansible/modules/messaging/kafka_topics.py:313:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/messaging/kafka_topics.py:315:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:315:17: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:316:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:318:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:319:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:319:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:320:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:320:17: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:321:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:321:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:322:27: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:322:29: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:323:19: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:323:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:324:19: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:324:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:325:33: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:326:23: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:326:25: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:331:11: E201 whitespace after '['
lib/ansible/modules/messaging/kafka_topics.py:334:11: E201 whitespace after '['
lib/ansible/modules/messaging/kafka_topics.py:337:11: E201 whitespace after '['
lib/ansible/modules/messaging/kafka_topics.py:342:22: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:342:24: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:343:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:343:22: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:344:28: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:344:30: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:351:1: W293 blank line contains whitespace
lib/ansible/modules/messaging/kafka_topics.py:360:12: E111 indentation is not a multiple of four
lib/ansible/modules/messaging/kafka_topics.py:385:21: E126 continuation line over-indented for hanging indent
lib/ansible/modules/messaging/kafka_topics.py:391:1: W293 blank line contains whitespace

The test ansible-test sanity --test pylint [?] failed with the following errors:

lib/ansible/modules/messaging/kafka_topics.py:191:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:210:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:248:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:289:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:311:12: undefined-variable Undefined variable 'module'

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.action.type: not a valid value for dictionary value @ data['options']['action']['type']. Got 'str'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.config.type: not a valid value for dictionary value @ data['options']['config']['type']. Got 'dict'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.jaas_auth_file.type: not a valid value for dictionary value @ data['options']['jaas_auth_file']['type']. Got 'path'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.kafka_path.type: not a valid value for dictionary value @ data['options']['kafka_path']['type']. Got 'path'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.partitions.type: not a valid value for dictionary value @ data['options']['partitions']['type']. Got 'int'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.replication_factor.type: not a valid value for dictionary value @ data['options']['replication_factor']['type']. Got 'int'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.topic.type: not a valid value for dictionary value @ data['options']['topic']['type']. Got 'list'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.zookeeper.type: not a valid value for dictionary value @ data['options']['zookeeper']['type']. Got 'list'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E307 version_added should be 2.4. Currently 2.5
lib/ansible/modules/messaging/kafka_topics.py:144:0: E107 Imports should be directly below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Sep 5, 2017

The test ansible-test sanity --test boilerplate [?] failed with the following error:

Command "test/sanity/code-smell/boilerplate.sh" returned exit status 2.
>>> Standard Output
== Missing __metaclass__ = type ==
./lib/ansible/modules/messaging/kafka_topics.py

== Missing from __future__ import (absolute_import, division, print_function) ==
./lib/ansible/modules/messaging/kafka_topics.py

The test ansible-test sanity --test no-dict-iteritems [?] failed with the following error:

Command "test/sanity/code-smell/no-dict-iteritems.sh" returned exit status 1.
>>> Standard Output
iteritems has been removed in python3.  Alternatives:
    for KEY, VALUE in DICT.items():
    from ansible.module_utils.six import iteritems ; for KEY, VALUE in iteritems(DICT):
./lib/ansible/modules/messaging/kafka_topics.py:                    "%s=%r" % (key, value) for (key, value) in self.config.iteritems())

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/messaging/kafka_topics.py:41:66: W291 trailing whitespace
lib/ansible/modules/messaging/kafka_topics.py:135:161: E501 line too long (231 > 160 characters)
lib/ansible/modules/messaging/kafka_topics.py:150:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/messaging/kafka_topics.py:153:1: W293 blank line contains whitespace
lib/ansible/modules/messaging/kafka_topics.py:154:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/messaging/kafka_topics.py:162:23: E221 multiple spaces before operator
lib/ansible/modules/messaging/kafka_topics.py:229:21: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:237:24: E201 whitespace after '{'
lib/ansible/modules/messaging/kafka_topics.py:237:58: E202 whitespace before '}'
lib/ansible/modules/messaging/kafka_topics.py:242:24: E225 missing whitespace around operator
lib/ansible/modules/messaging/kafka_topics.py:264:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:274:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:284:24: E201 whitespace after '{'
lib/ansible/modules/messaging/kafka_topics.py:284:58: E202 whitespace before '}'
lib/ansible/modules/messaging/kafka_topics.py:300:21: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:301:51: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:302:51: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:307:24: E201 whitespace after '{'
lib/ansible/modules/messaging/kafka_topics.py:307:58: E202 whitespace before '}'
lib/ansible/modules/messaging/kafka_topics.py:313:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/messaging/kafka_topics.py:315:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:315:17: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:316:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:318:25: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:319:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:319:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:320:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:320:17: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:321:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:321:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:322:27: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:322:29: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:323:19: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:323:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:324:19: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:324:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:325:33: E127 continuation line over-indented for visual indent
lib/ansible/modules/messaging/kafka_topics.py:326:23: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:326:25: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:331:11: E201 whitespace after '['
lib/ansible/modules/messaging/kafka_topics.py:334:11: E201 whitespace after '['
lib/ansible/modules/messaging/kafka_topics.py:337:11: E201 whitespace after '['
lib/ansible/modules/messaging/kafka_topics.py:342:22: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:342:24: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:343:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:343:22: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:344:28: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:344:30: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/messaging/kafka_topics.py:351:1: W293 blank line contains whitespace
lib/ansible/modules/messaging/kafka_topics.py:360:12: E111 indentation is not a multiple of four
lib/ansible/modules/messaging/kafka_topics.py:385:21: E126 continuation line over-indented for hanging indent
lib/ansible/modules/messaging/kafka_topics.py:391:1: W293 blank line contains whitespace

The test ansible-test sanity --test pylint [?] failed with the following errors:

lib/ansible/modules/messaging/kafka_topics.py:191:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:210:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:248:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:289:12: undefined-variable Undefined variable 'module'
lib/ansible/modules/messaging/kafka_topics.py:311:12: undefined-variable Undefined variable 'module'

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.action.type: not a valid value for dictionary value @ data['options']['action']['type']. Got 'str'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.config.type: not a valid value for dictionary value @ data['options']['config']['type']. Got 'dict'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.jaas_auth_file.type: not a valid value for dictionary value @ data['options']['jaas_auth_file']['type']. Got 'path'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.kafka_path.type: not a valid value for dictionary value @ data['options']['kafka_path']['type']. Got 'path'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.partitions.type: not a valid value for dictionary value @ data['options']['partitions']['type']. Got 'int'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.replication_factor.type: not a valid value for dictionary value @ data['options']['replication_factor']['type']. Got 'int'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.topic.type: not a valid value for dictionary value @ data['options']['topic']['type']. Got 'list'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E305 DOCUMENTATION.options.zookeeper.type: not a valid value for dictionary value @ data['options']['zookeeper']['type']. Got 'list'
lib/ansible/modules/messaging/kafka_topics.py:0:0: E307 version_added should be 2.4. Currently 2.5
lib/ansible/modules/messaging/kafka_topics.py:144:0: E107 Imports should be directly below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.

click here for bot help

@samdoran samdoran removed the needs_triage label Sep 5, 2017

@mattclay mattclay added the ci_verified label Sep 5, 2017

@pdeaudney

This comment has been minimized.

pdeaudney commented Sep 7, 2017

If you're using Confluent Kafka debian packages, the kafka-topics script exists at /usr/bin/kafka-topics

The list and describe actions don't output anything unless I am running under verbose output (is that expected?).

The create action required me to comment lines 283-284 out. However that did work after doing so.

ansible 2.3.2.0
config file = /Users/pdeaudney/git/aws-infrastructure/couchbase-kafka/ansible/ansible.cfg
configured module search path = [u'./library']
python version = 2.7.13 (default, Jul 18 2017, 09:17:00) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]

If this is the wrong place for feedback, please let me know and I will provide it elsewhere.

@gdelpierre

This comment has been minimized.

Contributor

gdelpierre commented Sep 7, 2017

Hi @pdeaudney , thank you for the feedback.
I'm not using the debian packages.
Which kafka version are you using ?

@ansibot ansibot removed the ci_verified label Sep 7, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Sep 7, 2017

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/messaging/kafka_topics.py:41:66: W291 trailing whitespace
lib/ansible/modules/messaging/kafka_topics.py:146:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/messaging/kafka_topics.py:308:18: E225 missing whitespace around operator
lib/ansible/modules/messaging/kafka_topics.py:324:51: E231 missing whitespace after ','
lib/ansible/modules/messaging/kafka_topics.py:326:54: E231 missing whitespace after ','
lib/ansible/modules/messaging/kafka_topics.py:328:38: E231 missing whitespace after ','

click here for bot help

@ansibot ansibot added the ci_verified label Sep 7, 2017

@ansibot ansibot removed the ci_verified label Sep 7, 2017

@ansibot ansibot removed the ci_verified label Sep 18, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Sep 18, 2017

The test ansible-test compile --python 2.6 [?] failed with the following error:

test/units/modules/messaging/test_kafka.py:168:16: SyntaxError: "ReplicationFactor:1\\\\t" + \

The test ansible-test compile --python 2.7 [?] failed with the following error:

test/units/modules/messaging/test_kafka.py:168:16: SyntaxError: "ReplicationFactor:1\\\\t" + \

The test ansible-test compile --python 3.5 [?] failed with the following error:

test/units/modules/messaging/test_kafka.py:168:16: SyntaxError: "ReplicationFactor:1\\\\t" + \

The test ansible-test compile --python 3.6 [?] failed with the following error:

test/units/modules/messaging/test_kafka.py:168:16: SyntaxError: "ReplicationFactor:1\\\\t" + \

The test ansible-test sanity --test pep8 [?] failed with the following errors:

test/units/modules/messaging/test_kafka.py:46:46: E128 continuation line under-indented for visual indent
test/units/modules/messaging/test_kafka.py:47:46: E128 continuation line under-indented for visual indent
test/units/modules/messaging/test_kafka.py:48:46: E128 continuation line under-indented for visual indent
test/units/modules/messaging/test_kafka.py:168:17: E113 unexpected indentation
test/units/modules/messaging/test_kafka.py:169:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:170:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:171:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:172:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:173:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:175:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:176:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:177:17: E122 continuation line missing indentation or outdented
test/units/modules/messaging/test_kafka.py:178:17: E122 continuation line missing indentation or outdented

The test ansible-test sanity --test pylint [?] failed with the following error:

test/units/modules/messaging/test_kafka.py:168:0: syntax-error unexpected indent

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Sep 18, 2017

The test ansible-test sanity --test pylint [?] failed with the following error:

test/units/modules/messaging/test_kafka.py:34:0: dangerous-default-value Dangerous default value [] as argument

click here for bot help

gdelpierre added some commits Sep 18, 2017

@gdelpierre

This comment has been minimized.

Contributor

gdelpierre commented Sep 27, 2017

Hi @chrishoffman @hyperized @manuel-sousa @retr0h @romanek-adam , could you please review this PR and add the shipit label?

@EddyP23

This comment has been minimized.

EddyP23 commented Oct 4, 2017

I looked at the kafka_topics module and it looks great.

One question though. Is there any way to reuse the zookeepers defined in the inventory file? Currently if you want to use it you need to specify exact IPs, but it seems to be much more ansible-like to be able to reuse inventory file for this.

Ideally I would like to do something like:

- name: List Kafka Topics
  kafka_topics:
    action: 'list'
    zookeeper: 'zookeeperGroupInInventory'

The best way I found to achieve this now is using this not pretty expression:
- "{{ hostvars[groups['zookeeperNodes'][0]]['ansible_default_ipv4']['address'] }}"

@EddyP23

This comment has been minimized.

EddyP23 commented Oct 4, 2017

Also, this seems like a bug to me:

TASK [test-list-kafka-nodes : Create a new Kafka Topic] *************************************************************************************************************************
ok: [zoo_01] => {"changed": false, "failed": false, "stderr": "", "stderr_lines": [], "stdout": "WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.\nCreated topic \"ansible_test_topic_467\".\n", "stdout_lines": ["WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.", "Created topic \"ansible_test_topic_467\"."]}

It says changed: false but also Created topic.

Interesting thing to note, that if I fix the annoying warning in the output, then changed becomes true.

@gdelpierre

This comment has been minimized.

Contributor

gdelpierre commented Oct 4, 2017

@EddyP23 thank you for the feedback.

It says changed: false but also Created topic.
Interesting thing to note, that if I fix the annoying warning in the output, then changed becomes true

I just modify the regexp. Could you test it now ?

@mattclay

This comment has been minimized.

Member

mattclay commented Oct 5, 2017

CI failure in unit tests:

>           self.assertTrue(result.exception.args[0]['changed'])
E           AssertionError: False is not true

test/units/modules/messaging/test_kafka.py:110: AssertionError

@mattclay mattclay added the ci_verified label Oct 5, 2017

@EddyP23

This comment has been minimized.

EddyP23 commented Oct 5, 2017

@gdelpierre it seems to be working now for me, thanks.

@tkochanek

This comment has been minimized.

tkochanek commented Dec 4, 2017

Hi, looking at action list it seems the module is doing an action
According to ansible principle it should define target state: topic present or absent
This can be of course achieved with developed actions however is not included in the module

@hauke-altmann-as

This comment has been minimized.

hauke-altmann-as commented Sep 19, 2018

This module would be very useful to us. What's the status of this PR? Any chance that this module will be added in the near future?

@gdelpierre

This comment has been minimized.

Contributor

gdelpierre commented Sep 19, 2018

Hi @hauke-altmann-as , I’m still working on this module, I hope it can be added to the 2.8 or 2.9. If you can test it and give me some feedback it would be very appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment