-
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.
* Add SASL based authentication * Fix default tests
- Loading branch information
1 parent
5c81ecc
commit b7f8915
Showing
8 changed files
with
96 additions
and
16 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 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 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 |
---|---|---|
@@ -1,13 +1,32 @@ | ||
--- | ||
- name: Create kafka group | ||
group: | ||
name: '{{ kafka_group }}' | ||
state: present | ||
|
||
- name: Create kafka user | ||
user: | ||
name: '{{ kafka_user }}' | ||
group: '{{ kafka_group }}' | ||
state: present | ||
createhome: no | ||
|
||
- name: Create kafka config dir | ||
file: | ||
path: "{{ kafka_conf_dir }}" | ||
state: directory | ||
owner: '{{ kafka_user }}' | ||
group: '{{ kafka_group }}' | ||
mode: '0755' | ||
|
||
- import_tasks: sasl-auth.yml | ||
tags: [kafka, kafka_config, config, sasl, auth] | ||
|
||
- name: Create kafka server properties file | ||
template: | ||
src: server.properties.j2 | ||
dest: "{{ kafka_conf_dir }}/server.properties" | ||
owner: '{{ kafka_user }}' | ||
group: '{{ kafka_group }}' | ||
mode: '0644' | ||
notify: Reload kafka |
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 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
- import_tasks: install.yml | ||
tags: [kafka, kafka_install, install] | ||
- import_tasks: config.yml | ||
tags: [kafka, kafka_config, config] | ||
- import_tasks: install.yml | ||
tags: [kafka, kafka_install, install] |
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,40 @@ | ||
--- | ||
- name: Create JAAS configuration for Kafka broker | ||
template: | ||
src: kafka_server_jaas.conf.j2 | ||
dest: "{{ kafka_conf_dir }}/kafka_server_jaas.conf" | ||
owner: '{{ kafka_user }}' | ||
group: '{{ kafka_group }}' | ||
mode: '0644' | ||
notify: Reload kafka | ||
|
||
- name: Add to kafka_environment_variables variable if it already exists | ||
set_fact: | ||
kafka_environment_variables: "{{ kafka_environment_variables | combine({'KAFKA_OPTS': '-Djava.security.auth.login.config=' + kafka_conf_dir + '/kafka_server_jaas.conf'}) }}" | ||
when: kafka_environment_variables is defined | ||
|
||
- name: Set fresh kafka_environment_variables variable if it does not exist | ||
set_fact: | ||
kafka_environment_variables: | ||
KAFKA_OPTS: "-Djava.security.auth.login.config={{ kafka_conf_dir }}/kafka_server_jaas.conf" | ||
when: kafka_environment_variables is not defined | ||
|
||
- name: Set Kafka listeners variable | ||
set_fact: | ||
kafka_listeners: "PLAINTEXT://{{ inventory_hostname }}:9092" | ||
when: kafka_listeners is not defined | ||
|
||
- name: Set Kafka inter-broker communication protocol | ||
set_fact: | ||
kafka_security_inter_broker_protocol: "PLAINTEXT" | ||
when: kafka_security_inter_broker_protocol is not defined | ||
|
||
- name: Set SASL mechanism for Kafka inter-broker communication protocol | ||
set_fact: | ||
kafka_sasl_mechanism_inter_broker_protocol: "PLAIN" | ||
when: kafka_sasl_mechanism_inter_broker_protocol is not defined | ||
|
||
- name: Set enabled SASL mechanisms for Kafka | ||
set_fact: | ||
kafka_sasl_enabled_mechanisms: "PLAIN" | ||
when: kafka_sasl_enabled_mechanisms is not defined |
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,9 @@ | ||
KafkaServer { | ||
org.apache.kafka.common.security.plain.PlainLoginModule required | ||
username="{{ kafka_server_username }}" | ||
password="{{ kafka_server_password }}" | ||
user_{{ kafka_server_username }}="{{ kafka_server_password }}" | ||
{% for client in kafka_client_users %} | ||
user_{{ client.username }}="{{ client.password }}" | ||
{% endfor %}; | ||
}; |
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