StephenSorriaux / ansible-kafka-admin

Manage your topic's configuration (partitions, replication factor, parameters), ACLs, quotas, users and get stats, without any effort with this library. It does not use the Kafka scripts and does not require ssh connection to the remote broker.
Apache License 2.0
150 stars 46 forks source link

Consumer group ACL creation issue on 0.19.0 #161

Closed michael-todorovic closed 3 weeks ago

michael-todorovic commented 12 months ago

Expected Behavior

We upgraded to 0.19.0. We have a topic where ACLs are OK. We want to grant some perms for a consumer group on this topic

Actual Behavior

When applying the permission for the consumer group, Ansible is happy but no consumer group is created. We rollbacked to 0.18.2 and the ACL is created so this looks related to 0.19.0 :)

Play to Reproduce the Problem

Logs from the play with Ansible in debug mode

ANSIBLE_DEBUG=true ansible-playbook my-awesome-playbook.yml

COPY/PASTE the result of the play here

Specifications

StephenSorriaux commented 11 months ago

Hello,

Thank you for the issue.

I tried to reproduce it locally with the Python & Kafka versions you provided but was not able to trigger the issue.

My playbook was (tested with kafka_acl and kafka_acls modules):

---
- 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:
        api_version: "3.1.0"
        name: 'my-consumer-group'
        acl_resource_type: 'group'
        acl_principal: 'User:consumer-client'
        acl_operations:
          - 'read'
        acl_permission: 'allow'
        acl_pattern_type: 'literal'
        bootstrap_servers: "localhost:9092"

    - name: "Get ACLs information"
      kafka_info:
        resource: "acl"
        api_version: "3.1.0"
        bootstrap_servers: "localhost:9092"
      register: acls

    - name: "Display results"
      debug:
        var: acls

The ACL for the consumer group my-consumer-group ends up being displayed in the results:

TASK [Display results] ***********************************************************************
ok: [127.0.0.1] => {
    "acls": {
        "ansible_module_results": {
            "group": {
                "my-consumer-group": [
                    {
                        "host": "*",
                        "operation": "read",
                        "pattern_type": "literal",
                        "permission_type": "allow",
                        "principal": "User:consumer-client",
                        "resource_name": "my-consumer-group",
                        "resource_type": "group"
                    }
                ]
            }
        },
        "changed": true,
        "failed": false
    }
}

I also made sure I got the same results with the kafka-acls.sh script:

# kafka-acls.sh --list --group my-consumer-group --authorizer-properties zookeeper.connect=localhost:2181
Current ACLs for resource `ResourcePattern(resourceType=GROUP, name=my-consumer-group, patternType=LITERAL)`: 
    (principal=User:consumer-client, host=*, operation=READ, permissionType=ALLOW)

Would it be possible for you to share a minimalist reproducible example?