Created
June 27, 2020 18:47
-
-
Save alonisser/78c28e57782513778ff32c536d1305e2 to your computer and use it in GitHub Desktop.
Ansible role for running the kafka-consumer-groups cli tool from docker with changing .properties according to env
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
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}}"; |
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
- 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