-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/multiple acl operations (#136)
* kafka_acls change module spec to support multiple operations add acl multi operations examples allow to mark as absent all operations of a resource ( #124 ) * kafka_acls: add parametrized test to verify acls multi ops
- Loading branch information
Showing
12 changed files
with
349 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
version: '2' | ||
services: | ||
zookeeper: | ||
image: zookeeper:3.6 | ||
command: "bin/zkServer.sh start-foreground" | ||
network_mode: "host" | ||
container_name: zookeeper | ||
kafka: | ||
image: wurstmeister/kafka:2.13-2.6.0 | ||
command: "start-kafka.sh" | ||
container_name: kafka | ||
network_mode: "host" | ||
environment: | ||
KAFKA_DELETE_TOPIC_ENABLE: "true" | ||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 | ||
KAFKA_LISTENERS: PLAINTEXT://:9092 | ||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT | ||
KAFKA_ZOOKEEPER_CONNECT: localhost:2181 | ||
KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer | ||
KAFKA_SUPER_USERS: User:admin | ||
KAFKA_SASL_ENABLED_MECHANISMS: PLAIN | ||
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN | ||
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" | ||
KAFKA_OPTS: -Djava.security.auth.login.config=/opt/kafka/jaas/kafka_server_jaas.conf | ||
volumes: | ||
- ./kafka_server_jaas.conf:/opt/kafka/jaas/kafka_server_jaas.conf |
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 @@ | ||
KafkaServer { | ||
org.apache.kafka.common.security.plain.PlainLoginModule required | ||
username="admin" | ||
password="admin-secret" | ||
user_admin="admin-secret" | ||
user_alice="alice-secret"; | ||
}; |
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,98 @@ | ||
--- | ||
- name: Example | ACL creation | ||
hosts: 127.0.0.1 | ||
roles: | ||
- name: kafka_lib | ||
post_tasks: | ||
- name: "Create a single ACL with multiple operations" | ||
kafka_acl: | ||
name: 'my-topic' | ||
api_version: "2.6.0" | ||
acl_resource_type: 'topic' | ||
acl_principal: 'User:producer-client' | ||
acl_operation: 'write' | ||
acl_permission: 'allow' | ||
acl_pattern_type: 'literal' | ||
bootstrap_servers: "localhost:9092" | ||
|
||
- name: "Create a single ACL with multiple operations" | ||
kafka_acl: | ||
name: 'my-topic' | ||
api_version: "2.6.0" | ||
acl_resource_type: 'topic' | ||
acl_principal: 'User:producer-client' | ||
acl_operations: | ||
- 'write' | ||
- 'describe' | ||
- 'create' | ||
acl_permission: 'allow' | ||
acl_pattern_type: 'literal' | ||
bootstrap_servers: "localhost:9092" | ||
|
||
|
||
- name: "Create multiple ACL with multiple operations" | ||
kafka_acls: | ||
|
||
acls: | ||
- name: 'my-topic' | ||
acl_resource_type: 'topic' | ||
acl_principal: 'User:consumer-client' | ||
acl_operations: | ||
- 'describe' | ||
- 'read' | ||
acl_permission: 'allow' | ||
acl_pattern_type: 'literal' | ||
|
||
- name: 'my-consumer-group' | ||
acl_resource_type: 'group' | ||
acl_principal: 'User:consumer-client' | ||
acl_operations: | ||
- 'read' | ||
acl_permission: 'allow' | ||
acl_pattern_type: 'literal' | ||
|
||
api_version: "2.6.0" | ||
bootstrap_servers: "localhost:9092" | ||
|
||
- name: "Get ACLs information" | ||
kafka_info: | ||
resource: "acl" | ||
api_version: "2.6.0" | ||
bootstrap_servers: "localhost:9092" | ||
register: acls | ||
|
||
- name: "Display results" | ||
debug: | ||
var: acls | ||
|
||
|
||
- name: "Delete multiple ACL with multiple operations" | ||
kafka_acls: | ||
|
||
acls: | ||
- name: 'my-topic' | ||
acl_resource_type: 'topic' | ||
acl_principal: 'User:producer-client' | ||
acl_operations: | ||
- 'write' | ||
acl_permission: 'allow' | ||
acl_pattern_type: 'literal' | ||
state: 'absent' | ||
|
||
# Delete ALL operations | ||
- name: 'my-topic' | ||
acl_principal: 'User:consumer-client' | ||
state: 'absent' | ||
|
||
bootstrap_servers: "localhost:9092" | ||
|
||
- name: "Get ACLs information" | ||
kafka_info: | ||
resource: "acl" | ||
api_version: "2.6.0" | ||
bootstrap_servers: "localhost:9092" | ||
register: acls | ||
|
||
- name: "Display results" | ||
debug: | ||
var: acls |
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
Oops, something went wrong.