jaytaylor.kafka
Ansible Kafka
This is an Ansible role that helps you install and set up Kafka, a system used for managing message queues in a distributed setup.
How to Get It
To include this role in your playbooks, add the following to your requirements.yml
file:
- src: https://github.com/jaytaylor/ansible-kafka
Then, run this command:
ansible-galaxy install -r requirements.yml --ignore-errors
If you want to download this role directly, you can do it like this:
cd my-playbook-folder/roles
git clone https://github.com/jaytaylor/ansible-kafka.git
cd -
How to Use It
After installing the role, you need to configure it in your playbook file (for example, playbook.yml
).
Here’s an example of how to configure it:
---
- hosts: [all]
roles:
- {
role: "ansible-kafka",
kafka_hosts: "{{ groups.kafka | list }}",
kafka_zookeeper_hosts: "{{ zookeeper_hosts | list }}",
kafka_version: 0.11.0.2, # Override for Kafka version.
kafka_scala_version: 2.10 # Override for Scala version.
}
In this example, kafka_hosts
and zookeeper_hosts
are variables that you need to define (like in group_vars/all
) that list the hosts you want to use.
Important Note
If you are using this role from the Ansible Galaxy website, make sure to use "jaytaylor.kafka" as the role name instead of "ansible-kafka".
Role Variables
kafka_hosts
- List of hosts in the Kafka cluster.kafka_zookeeper_hosts
- List of Zookeeper hosts for the cluster.kafka_broker_id
- An integer that uniquely identifies the broker. A default will be generated for you unless specified.kafka_generate_broker_id
- A flag indicating whether to generate a broker ID. Defaults toyes
.kafka_server_defaults
- Default settings for Kafka server. It's usually not needed to change this.kafka_producer_defaults
- Default settings for Kafka producer. It's usually not needed to change this.kafka_server
- Allows you to change specific default server settings using this hash.kafka_producer
- Allows you to change specific default producer settings using this hash.kafka_healthcheck_address
- If not specified, it will be set tokafka_server_defaults.host_name
orkafka_server.host_name
if defined. Defaults to '127.0.0.1'.kafka_java_version
- Java version to install. Defaults to "openjdk-7-jre-headless".
Version Notes
Version 2.0.0 requires Ansible 2.2 or higher.
In versions prior to 2.0.0, server
and producer
variables controlled the settings for Kafka Server and Producer. In version 2.0.0, the following changes were made:
- The
server
variable was renamed tokafka_server
for better organization. It's a hash that works withkafka_server_defaults
, allowing for easier customization of specific settings without altering everything. - Similarly, the
producer
variable becamekafka_producer
, functioning the same way askafka_server
. - The variable
healthcheck_address
is nowkafka_healthcheck_address
, improving its context. - The variable
nofiles_limit
is nowkafka_nofiles_limit
.
License
BSD
Author
Jay Taylor
An Ansible role for installing and configuring a kafka cluster.
ansible-galaxy install jaytaylor.kafka