Commit 017a091f 017a091f008c192b2c59e956d3339f38df8d80e1 by Khaled

modified: inventories/inventory.yml

	new file:   playbooks/kafka.yml
	new file:   roles/kafka/README.md
	new file:   roles/kafka/defaults/main.yml
	new file:   roles/kafka/handlers/main.yml
	new file:   roles/kafka/meta/main.yml
	new file:   roles/kafka/tasks/config.yml
	new file:   roles/kafka/tasks/install_JRE.yml
	new file:   roles/kafka/tasks/install_kafka.yml
	new file:   roles/kafka/tasks/main.yml
	new file:   roles/kafka/tasks/user.yml
	new file:   roles/kafka/templates/srvprop.j2
	new file:   roles/kafka/tests/inventory
	new file:   roles/kafka/tests/test.yml
	new file:   roles/kafka/vars/main.yml
1 parent 2b91fd39
......@@ -6,4 +6,8 @@ all:
zookeepernodes:
hosts:
znode1:
ansible_host: 172.17.0.2
\ No newline at end of file
ansible_host: 172.17.0.2
kafkabroker:
hosts:
broker1:
ansible_host: 172.17.0.4
\ No newline at end of file
......
---
- name : installation of kafka
hosts: broker1
become: yes
roles:
- ./roles/kafka
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for roles/kafka
broker_id: 1
listeners: PLAINTEXT://172.17.0.4:9092
numthreads: 3
numiothreads: 8
socket_send_buffer_bytes: 102400
socket_receive_buffer_bytes: 102400
socket_request_max_bytes: 104857600
log_dirs: /tmp/kafka-logs
num_partitions: 1
num_recovery_threads_per_data_dir: 1
offsets_topic_replication_factor: 1
transaction_state_log_replication_factor: 1
transaction_state_log_min_isr: 1
log_retention_hours: 168
log_segment_bytes: 1073741824
log_retention_check_interval_ms: 300000
zookeeper_connect: znode1:2181
zookeeper_connection_timeout_ms: 6000
group_initial_rebalance_delay_ms: 0
\ No newline at end of file
---
# handlers file for roles/kafka
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
- name: set the server configuration
\ No newline at end of file
- name: install JRE
apt:
name: default-JRE
state: present
autoclean: yes
cache_valid_time: 3600
\ No newline at end of file
- name: Download kafka package
get_url:
url: https://downloads.apache.org/kafka/3.3.1/kafka-3.3.1-src.tgz
dest: /opt/kafka-3.3.1-src.tgz
- name: unzip the downloaded jdk
unarchive:
src: /opt/kafka-3.3.1-src.tgz
dest: /opt
remote_src: yes
\ No newline at end of file
---
- include_tasks: "user.yml"
- include_tasks: "install_JRE.yml"
- include_tasks: "install_kafka.yml"
\ No newline at end of file
- name: create the group kafka
group:
name: kafka
- name: create user for kafka
user:
name: kafka
group: kafka
password: "{{ my_password | password_hash('sha512') }}"
register: __kafka_user__
\ No newline at end of file
broker.id= {{broker_id}}
listeners= {{listeners}}
num.network.threads= {{numthreads}}
num.io.threads= {{numiothreads}}
socket.send.buffer.bytes= {{socket_send_buffer_bytes}}
socket.receive.buffer.bytes= {{socket_receive_buffer_bytes}}
socket.request.max.bytes= {{socket_request_max_bytes}}
log.dirs= {{log_dirs}}
num.partitions= {{num_partitions}}
num.recovery.threads.per.data.dir= {{num_recovery_threads_per_data_dir}}
offsets.topic.replication.factor= {{offsets_topic_replication_factor}}
transaction.state.log.replication.factor= {{transaction_state_log_replication_factor}}
transaction.state.log.min.isr= {{transaction_state_log_min_isr}}
log.retention.hours= {{log_retention_hours}}
log.segment.bytes= {{log_segment_bytes}}
log.retention.check.interval.ms= {{log_retention_check_interval_ms}}
zookeeper.connect= {{zookeeper_connect}}
zookeeper.connection.timeout.ms= {{zookeeper_connection_timeout_ms}}
group.initial.rebalance.delay.ms= {{group_initial_rebalance_delay_ms}}
---
- hosts: localhost
remote_user: root
roles:
- roles/kafka
---
# vars file for roles/kafka