文章预览
--- - name: Install Kafka and Zookeeper on single node hosts: localhost become: true tasks: - name: Install Java (if not already installed) apt: name: default-jre state: present - name: Download and extract Kafka unarchive: src: https://downloads.apache.org/kafka/3.5.0/kafka_2.13-3.5.0.tgz dest: /opt/ remote_src: yes creates: /opt/kafka_2.13-3.5.0 - name: Download and extract Zookeeper unarchive: src: https://downloads.apache.org/zookeeper/zookeeper-3.8.1/apache-zookeeper-3.8.1-bin.tar.gz dest: /opt/ remote_src: yes creates: /opt/apache-zookeeper-3.8.1-bin - name: Set up Kafka environment variables lineinfile: path: /etc/profile line: "export KAFKA_HOME=/opt/kafka_2.13-3.5.0" create: yes - name: Set up Zookeeper environment variables lineinfile:
………………………………