kafka-install.yml 1.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---

- hosts: master
  user: root
  tasks:
    - name: Download Apache Kafka.
      get_url: url=http://mirrors.myaegean.gr/apache/kafka/0.8.2.1/kafka_2.10-0.8.2.1.tgz dest=/root/kafka_2.10-0.8.2.1.tgz
      tags:
        - download

    - name: Uncompress Apache Kafka.
      unarchive: src=/root/kafka_2.10-0.8.2.1.tgz dest=/usr/local copy=no
      tags:
        - uncompress

    - name: Create softlink for Apache Kafka.
      file: src=/usr/local/kafka_2.10-0.8.2.1 dest=/usr/local/kafka state=link
      tags:
        - uncompress

    - name: Configure Apache kafka.
      copy: src=../files/usr/local/kafka/config/server.properties dest=/usr/local/kafka/config/server.properties owner=root group=root mode=0644
      tags:
        - configure-kafka

    - name: Start Apache Zookeeper server.
      shell: /usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties
      async: 31536000 # Stay alive for a year(1 year = 31536000 seconds).
      poll: 0
      tags:
        - start-zookeeper

    - name: Wait for Apache Zookeeper to become available.
      wait_for: port=2181
      tags:
        - start-zookeeper

    - name: Start Apache Kafka server.
      shell: /usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties
      async: 31536000 # Stay alive for a year(1 year = 31536000 seconds).
      poll: 0
      tags:
        - start-kafka

    - name: Wait for Apache Kafka server to become available.
      wait_for: port=9092
      tags:
        - start-kafka