Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"confluent-kafka.service" file not found when installing with archive and not using confluent_server #1550

Open
PACordonnier opened this issue Feb 6, 2024 · 1 comment

Comments

@PACordonnier
Copy link

PACordonnier commented Feb 6, 2024

Describe the issue
Fail to install kafka-broker with "confluent_server_enabled=false" and "installation_method=archive". Ansible fails to extract 'confluent-kafka.service' file, as it is not present in the .tar.gz.

To Reproduce
Steps to reproduce the behaviour:

  • Launch playbook kafka_broker.yml with these two variables
    • installation_method=archive
    • confluent_server_enabled=false
  • Installation fails here with error

# Archive File deployments need to create SystemD service units
# Copy the tarball's systemd service to the system
- name: Copy Kafka Broker Service from archive file to system
copy:
src: "{{binary_base_path}}/lib/systemd/system/{{kafka_broker.systemd_file|basename}}"
remote_src: true
dest: "{{kafka_broker.systemd_file}}"
mode: '644'
force: true
when: installation_method == "archive"
tags:
- systemd
- privileged

TASK [confluent.platform.kafka_broker : Copy Kafka Broker Service from archive file to system] *******************************************************************************************************************************************************************************************************************************
fatal: [master-02]: FAILED! => changed=false 
  msg: Source /opt/confluent/confluent-7.5.3/lib/systemd/system/confluent-kafka.service not found

Expected behaviour

Since I'm using 'confluent_server_enabled=false', the kafka broker service name is confluent-kafka, not confluent-server.

kafka_broker_service_name: "{{ 'confluent-server' if confluent_server_enabled|bool else 'confluent-kafka'}}"

This var is then used as the filename for the systemd service file. Except the .tar.gz only packages a confluent-server.service, not a confluent-kafka.service.

https://github.com/confluentinc/cp-ansible/blob/8254c0812e70f4e8801a2e6aa812673cdb6fcd55/roles/variables/vars/main.yml#L316C1-L316C77

I have checked using a package installation, the .rpm install includes such file, but I think the files are identical.

I see two way of fixing it:

  • Package the confluent kafka .tar.gz with a confluent-kafka.service file (which is identical of the current confluent-server.service.) This fix is to be done by the build team of confluent I guess.
  • Add some logic in ansible to rename confluent-server.service to confluent-kafka.service when copying from the .tar.gz to the systemd

Thank you. I can submit PR with the latter solution, but I think such a fix will always be ugly, adding some unecessary logic to rename a file that I feel should be included in the archive is really not nice.

Inventory File

[zookeeper:children]
master1
master2
master3

[kafka_broker:children]
master1
master2
master3

[all:vars]
confluent_server_enabled=false
[zookeeper:children]
master4
master5
master6

[kafka_broker:children]
master4
master5
master6

[all:vars]
confluent_server_enabled=false
installation_method=archive

Environment (please complete the following information):

  • OS: RockyLinux 8.7
  • CP-Ansible: release 7.5.3
  • Ansible Version core 2.16.2

Thank you for your work, hope this isn't duplicate.

@mansisinha
Copy link
Member

Hi @PACordonnier , please let us know if you're still running into this issue. The combination you have mentioned already works, here is the test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants