-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e102578
commit 3ce8297
Showing
6 changed files
with
74 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- name: Gather facts on listening ports | ||
listen_ports_facts: | ||
- name: Create list of listening ports | ||
set_fact: | ||
tcp_ports: "{{ ansible_facts.tcp_listen | map(attribute='port') | sort | list }}" | ||
- name: Verify Kafka port is in listening ports | ||
assert: | ||
that: | ||
- 9092 in tcp_ports | ||
- name: Check that Kafka log file exists | ||
stat: | ||
path: /var/log/kafka/server.log | ||
register: stat_log_result | ||
failed_when: not stat_log_result.stat.exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
- name: Create random topic name | ||
set_fact: | ||
topic_name: "{{ 9999999999999999999999 | random | to_uuid }}" | ||
run_once: yes | ||
- name: Add a topic to the Kafka server | ||
environment: | ||
KAFKA_OPTS: "-Djava.security.auth.login.config={{ kafka_conf_dir }}/jaas.cfg" | ||
command: "/usr/local/kafka/bin/kafka-topics.sh \ | ||
--create --bootstrap-server {{ kafka_host }}:9092 --replication-factor 3 --partitions 1 --topic {{ topic_name }} \ | ||
--command-config {{ kafka_test_client_conf }}" | ||
register: create_topic_result | ||
run_once: yes | ||
- name: Verify topic creation return code | ||
assert: | ||
that: | ||
- create_topic_result.rc == 0 | ||
- name: Verify topic creation output | ||
assert: | ||
that: | ||
- "'Created topic {{ topic_name }}' in create_topic_result.stdout" | ||
- name: List topics from the Kafka server | ||
environment: | ||
KAFKA_OPTS: "-Djava.security.auth.login.config={{ kafka_conf_dir }}/jaas.cfg" | ||
command: "/usr/local/kafka/bin/kafka-topics.sh \ | ||
--list --bootstrap-server {{ kafka_host }}:9092 \ | ||
--command-config {{ kafka_test_client_conf }}" | ||
register: list_topics_result | ||
changed_when: no | ||
- name: Verify topic listing return code | ||
assert: | ||
that: | ||
- list_topics_result.rc == 0 | ||
- name: Verify created topic is in topic list | ||
assert: | ||
that: | ||
- "'{{ topic_name }}' in list_topics_result.stdout" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- name: Test JMX connection without authentication | ||
shell: echo "exit" | java -jar /opt/jmxterm.jar -l {{ kafka_jmx_host }}:1099 | ||
register: jmx_status_noauth | ||
changed_when: no | ||
failed_when: jmx_status_noauth.rc != 1 | ||
- name: Test JMX connection with authentication | ||
shell: echo "exit" | java -jar /opt/jmxterm.jar -l {{ kafka_jmx_host }}:1099 -u jmx -p molecule | ||
register: jmx_status_auth | ||
changed_when: no | ||
- name: Verify JMX connection | ||
assert: | ||
that: | ||
- "'Welcome to JMX terminal' in jmx_status_auth.stderr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Verify Kafka installation | ||
hosts: kafka | ||
tasks: | ||
- include_tasks: base.yml | ||
- include_tasks: create_topic.yml | ||
- include_tasks: jmx.yml |