confluentinc / cp-ansible

Ansible playbooks for the Confluent Platform
Apache License 2.0
31 stars 406 forks source link

"Copy Kafka Connect Files" task should be executed after "Install Connect Plugins" #1766

Open jwich71 opened 3 weeks ago

jwich71 commented 3 weeks ago

Sometimes it is necessary to store additional jar files within the connector plugin directories in order to extend their function.

There is kafka_connect_copy_files for distributing such custom files. Unfortunately, the corresponding task “Copy Kafka Connect Files” is executed before the installation of the actual Connect plugins, so that the files are overwritten again.

It would therefore make more sense to run the “Copy Kafka Connect Files” task after installing the plugins (task “Install Connect Plugins”).

Example in Inventory File:

    kafka_connect_copy_files:
      # ibm client jar for mq sink connector
      - source_path: "{{ inventory_dir }}/connect_plugins/com.ibm.mq.allclient.jar"
        destination_path: /usr/share/java/confluentinc-kafka-connect-ibmmq/
      - source_path: "{{ inventory_dir }}/connect_plugins/com.ibm.mq.allclient.jar"
        destination_path: /usr/share/java/confluentinc-kafka-connect-ibmmq-sink/

Related yml file: ~/.ansible/collections/ansible_collections/confluent/platform/roles/kafka_connect/tasks/main.yml

204 - name: Install Connect Plugins
205   include_tasks: connect_plugins.yml
206
207 ### Workaround ###
208 - name: Copy Kafka Connect Files
209   include_role:
210     name: common
211     tasks_from: copy_files.yml
212   vars:
213     copy_files: "{{kafka_connect_copy_files}}"
214     user: "{{kafka_connect_user}}"
215     group: "{{kafka_connect_group}}"
216   when: kafka_connect_copy_files | length > 0
217   tags:
218     - configuration

Environment: