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: ...@@ -6,4 +6,8 @@ all:
6 zookeepernodes: 6 zookeepernodes:
7 hosts: 7 hosts:
8 znode1: 8 znode1:
9 ansible_host: 172.17.0.2
...\ No newline at end of file ...\ No newline at end of file
9 ansible_host: 172.17.0.2
10 kafkabroker:
11 hosts:
12 broker1:
13 ansible_host: 172.17.0.4
...\ No newline at end of file ...\ No newline at end of file
......
1 ---
2 - name : installation of kafka
3 hosts: broker1
4 become: yes
5 roles:
6 - ./roles/kafka
...\ No newline at end of file ...\ No newline at end of file
1 Role Name
2 =========
3
4 A brief description of the role goes here.
5
6 Requirements
7 ------------
8
9 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.
10
11 Role Variables
12 --------------
13
14 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.
15
16 Dependencies
17 ------------
18
19 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.
20
21 Example Playbook
22 ----------------
23
24 Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
25
26 - hosts: servers
27 roles:
28 - { role: username.rolename, x: 42 }
29
30 License
31 -------
32
33 BSD
34
35 Author Information
36 ------------------
37
38 An optional section for the role authors to include contact information, or a website (HTML is not allowed).
1 ---
2 # defaults file for roles/kafka
3 broker_id: 1
4 listeners: PLAINTEXT://172.17.0.4:9092
5 numthreads: 3
6 numiothreads: 8
7 socket_send_buffer_bytes: 102400
8 socket_receive_buffer_bytes: 102400
9 socket_request_max_bytes: 104857600
10 log_dirs: /tmp/kafka-logs
11 num_partitions: 1
12 num_recovery_threads_per_data_dir: 1
13 offsets_topic_replication_factor: 1
14 transaction_state_log_replication_factor: 1
15 transaction_state_log_min_isr: 1
16 log_retention_hours: 168
17 log_segment_bytes: 1073741824
18 log_retention_check_interval_ms: 300000
19 zookeeper_connect: znode1:2181
20 zookeeper_connection_timeout_ms: 6000
21 group_initial_rebalance_delay_ms: 0
...\ No newline at end of file ...\ No newline at end of file
1 ---
2 # handlers file for roles/kafka
1 galaxy_info:
2 author: your name
3 description: your role description
4 company: your company (optional)
5
6 # If the issue tracker for your role is not on github, uncomment the
7 # next line and provide a value
8 # issue_tracker_url: http://example.com/issue/tracker
9
10 # Choose a valid license ID from https://spdx.org - some suggested licenses:
11 # - BSD-3-Clause (default)
12 # - MIT
13 # - GPL-2.0-or-later
14 # - GPL-3.0-only
15 # - Apache-2.0
16 # - CC-BY-4.0
17 license: license (GPL-2.0-or-later, MIT, etc)
18
19 min_ansible_version: 2.1
20
21 # If this a Container Enabled role, provide the minimum Ansible Container version.
22 # min_ansible_container_version:
23
24 #
25 # Provide a list of supported platforms, and for each platform a list of versions.
26 # If you don't wish to enumerate all versions for a particular platform, use 'all'.
27 # To view available platforms and versions (or releases), visit:
28 # https://galaxy.ansible.com/api/v1/platforms/
29 #
30 # platforms:
31 # - name: Fedora
32 # versions:
33 # - all
34 # - 25
35 # - name: SomePlatform
36 # versions:
37 # - all
38 # - 1.0
39 # - 7
40 # - 99.99
41
42 galaxy_tags: []
43 # List tags for your role here, one per line. A tag is a keyword that describes
44 # and categorizes the role. Users find roles by searching for tags. Be sure to
45 # remove the '[]' above, if you add tags to this list.
46 #
47 # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
48 # Maximum 20 tags per role.
49
50 dependencies: []
51 # List your role dependencies here, one per line. Be sure to remove the '[]' above,
52 # if you add dependencies to this list.
1 - name: set the server configuration
...\ No newline at end of file ...\ No newline at end of file
1 - name: install JRE
2 apt:
3 name: default-JRE
4 state: present
5 autoclean: yes
6 cache_valid_time: 3600
...\ No newline at end of file ...\ No newline at end of file
1 - name: Download kafka package
2 get_url:
3 url: https://downloads.apache.org/kafka/3.3.1/kafka-3.3.1-src.tgz
4 dest: /opt/kafka-3.3.1-src.tgz
5
6 - name: unzip the downloaded jdk
7 unarchive:
8 src: /opt/kafka-3.3.1-src.tgz
9 dest: /opt
10 remote_src: yes
...\ No newline at end of file ...\ No newline at end of file
1 ---
2 - include_tasks: "user.yml"
3 - include_tasks: "install_JRE.yml"
4 - include_tasks: "install_kafka.yml"
...\ No newline at end of file ...\ No newline at end of file
1 - name: create the group kafka
2 group:
3 name: kafka
4
5
6
7 - name: create user for kafka
8 user:
9 name: kafka
10 group: kafka
11 password: "{{ my_password | password_hash('sha512') }}"
12 register: __kafka_user__
...\ No newline at end of file ...\ No newline at end of file
1 broker.id= {{broker_id}}
2 listeners= {{listeners}}
3 num.network.threads= {{numthreads}}
4 num.io.threads= {{numiothreads}}
5 socket.send.buffer.bytes= {{socket_send_buffer_bytes}}
6 socket.receive.buffer.bytes= {{socket_receive_buffer_bytes}}
7 socket.request.max.bytes= {{socket_request_max_bytes}}
8 log.dirs= {{log_dirs}}
9 num.partitions= {{num_partitions}}
10 num.recovery.threads.per.data.dir= {{num_recovery_threads_per_data_dir}}
11 offsets.topic.replication.factor= {{offsets_topic_replication_factor}}
12 transaction.state.log.replication.factor= {{transaction_state_log_replication_factor}}
13 transaction.state.log.min.isr= {{transaction_state_log_min_isr}}
14 log.retention.hours= {{log_retention_hours}}
15 log.segment.bytes= {{log_segment_bytes}}
16 log.retention.check.interval.ms= {{log_retention_check_interval_ms}}
17 zookeeper.connect= {{zookeeper_connect}}
18 zookeeper.connection.timeout.ms= {{zookeeper_connection_timeout_ms}}
19 group.initial.rebalance.delay.ms= {{group_initial_rebalance_delay_ms}}
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
1 ---
2 - hosts: localhost
3 remote_user: root
4 roles:
5 - roles/kafka
1 ---
2 # vars file for roles/kafka