cp-ansible
cp-ansible copied to clipboard
"confluent-kafka.service" file not found when installing with archive and not using confluent_server
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
https://github.com/confluentinc/cp-ansible/blob/8254c0812e70f4e8801a2e6aa812673cdb6fcd55/roles/kafka_broker/tasks/main.yml#L105-L117
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.
https://github.com/confluentinc/cp-ansible/blob/8254c0812e70f4e8801a2e6aa812673cdb6fcd55/roles/variables/vars/main.yml#L306
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 currentconfluent-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
toconfluent-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.