slaves.yml 1 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
---
  - name: Configure Apache kafka.
    copy: src=usr/local/kafka/config/server.properties dest=/usr/local/kafka/config/server.properties owner=root group=root mode=0644
    tags:
      - configure-kafka

  - name: Assign a unique id to this Apache Kafka server.
    lineinfile: dest=/usr/local/kafka/config/server.properties regexp="^broker.id=0" line="broker.id={{ id }}"
    tags:
      - configure-kafka

  - name: Configure the Apache Zookeeper host.
    lineinfile: dest=/usr/local/kafka/config/server.properties regexp="^zookeeper.connect=localhost:2181" line="zookeeper.connect={{ hostvars['master']['kafka-ip'] }}:2181"
    tags:
      - configure-kafka

  - 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