sleighzy / ansible-kafka

Ansible role for installing and configuring Apache Kafka on RedHat and Debian platforms.
MIT License
116 stars 79 forks source link

[Unpack Apache Kafka] Task failed when declared different location for kafka_root_dir #40

Closed vietdhsmartosc closed 3 months ago

vietdhsmartosc commented 3 months ago

I use this role to install Kafka-cluster on Ubuntu 22.04 My kafka_root_dir is /data/kafka When run ansible-playbook, I got error:

TASK [sleighzy.kafka : Unpack Apache Kafka] ** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoneType: None fatal: [kafka-0]: FAILED! => {"changed": false, "msg": "dest '/data/kafka' must be an existing dir"}

Should we create kafka_root_dir before [Unpack Apache Kafka] task

sleighzy commented 3 months ago

The kafka_root_dir is the top-level place you want to install kafka under. I think it should create the kafka part of that dir when it unpacks it, but may not create the /data root part you have there. Does that top-level /data directory already exist?

You probably just want kafka_root_dir to be /data in that case, as the kafka part will be automatically done because of the line below. If you have /data/kafka then it may get installed to /data/kafka/kafka

kafka_dir: "{{ kafka_root_dir }}/kafka"
vietdhsmartosc commented 3 months ago

Thank you for your explanation. The kafka_root_dir must exist before using the role. I've just added a sub-task to create that folder ^^