SHARE
TWEET

fedorm

a guest Jan 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---
  2. - name: Creating directories for Zookeeper and Kafka
  3.   file:
  4.     name: "{{ item }}"
  5.     state: directory
  6.   loop:
  7.    - "{{ kafka_data_dir }}"
  8.     - "{{ zookeeper_data_dir }}"
  9.     - "{{ zookeeper_log_dir }}"
  10.  
  11. - name: Creating network for kafka and zookeeper
  12.   docker_network:
  13.     name: kafka
  14.  
  15. - name: Getting Zookeeper image
  16.   docker_image:
  17.     name: confluentinc/cp-zookeeper
  18.     tag: "{{ zookeeper_image_tag }}"
  19.  
  20. - name: Getting Kafka image
  21.   docker_image:
  22.     name: confluentinc/cp-kafka
  23.     tag: "{{ kafka_image_tag }}"
  24.  
  25. - name: Starting Zookeeper
  26.   docker_container:
  27.     name: zookeeper
  28.     image: "confluentinc/cp-zookeeper:{{ zookeeper_image_tag }}"
  29.     state: started
  30.     published_ports:
  31.      - "2181:2181"
  32.     volumes:
  33.      - "{{ zookeeper_data_dir }}:/var/lib/zookeeper/data"
  34.       - "{{ zookeeper_log_dir }}:/var/lib/zookeeper/log"
  35.     env:
  36.       ZOOKEEPER_CLIENT_PORT: 2181
  37.     networks:
  38.       - name: kafka
  39.  
  40. - name: Waiting for zookeeper to come up
  41.   wait_for:
  42.     port: 2181
  43.  
  44. - name: Starting Kafka
  45.   docker_container:
  46.     name: kafka
  47.     image: "confluentinc/cp-kafka:{{ kafka_image_tag }}"
  48.     state: started
  49.     published_ports:
  50.      - "9092:9092"
  51.       - "12345:12345"
  52.     volumes:
  53.      - "{{ kafka_data_dir }}:/var/lib/kafka/data"
  54.     env:
  55.       KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
  56.       KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://{{ ansible_default_ipv4.address }}:9092"
  57.       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "{{ kafka_replication_factor }}"
  58.       KAFKA_LOG_FLUSH_INTERVAL_MS: "{{ kafka_log_flush_interval_ms }}"
  59.       KAFKA_MESSAGE_MAX_BYTES: "{{ kafka_message_max_bytes }}"
  60.       KAFKA_BROKER_ID: "{{ kafka_broker_id }}"
  61.       KAFKA_RESERVED_BROKER_MAX_ID: "{{ kafka_reserved_broker_max_id}}"
  62.       KAFKA_LOG_RETENTION_HOURS: "{{ kafka_log_retention_hours }}"
  63.       KAFKA_JMX_PORT: 12345
  64.       KAFKA_JMX_HOSTNAME: "{{ ansible_default_ipv4.address }}"
  65.     networks:
  66.       - name: kafka
  67.  
  68. - name: Waiting for Kafka to come up
  69.   wait_for:
  70.     port: 9092
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top