Ansible role for running the kafka-consumer-groups cli tool from docker with changing .properties according to env
bootstrap.servers={{ kafka_cluster.boostrap_servers }} | |
ssl.endpoint.identification.algorithm=https | |
security.protocol=SASL_SSL | |
sasl.mechanism=PLAIN | |
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="{{kafka_cluster.username}}" password="{{kafka_cluster.password}}"; |
- name: create temporary config file for kafka | |
template: src=config.properties dest="/tmp/config.properties" | |
- name: supplied command | |
debug: | |
msg: "{{command}}" | |
- name : run kafka-consumer-groups with supplied command | |
shell: docker run --rm -v /tmp/config.properties:/etc/kafka/config.properties confluentinc/cp-server:5.5.0 kafka-consumer-groups --bootstrap-server "{{kafka_cluster.boostrap_servers}}" --command-config /etc/kafka/config.properties {{command}} | |
register: result | |
- name: print result | |
debug: | |
msg: "{{ result.stdout.split('\n') }}" | |
- name: remove temporary config file | |
file: path=/tmp/config.properties state=absent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment