Created
September 25, 2023 17:48
-
-
Save hodrigohamalho/6b09862c13765ffb1a841d4b07405537 to your computer and use it in GitHub Desktop.
amq-streams-no-auth.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: "Ansible Playbook to install a Kafka cluster (+Zookeeper)" | |
hosts: all | |
vars: | |
ansible_user: ec2-user | |
ansible_become: true | |
ansible_ssh_private_key_file: /home/ec2-user/ramalho.cer | |
become_method: sudo | |
amq_streams_common_download_node: "" | |
amq_streams_common_download_dir: "/tmp" | |
amq_streams_zookeeper_auth_enabled: false | |
amq_streams_broker_listeners: | |
- BROKER://:{{ amq_streams_broker_listener_port }} | |
- REPLICATION://:{{ amq_streams_broker_listener_internal_port }} | |
# Listener for inter-broker communications | |
amq_streams_broker_inter_broker_listener: BROKER | |
# Enabling Broker replication | |
amq_streams_broker_offsets_topic_replication_factor: 3 | |
amq_streams_broker_transaction_state_log_replication_factor: 3 | |
amq_streams_broker_transaction_state_log_min_isr: 2 | |
# Topic Management | |
amq_streams_broker_topics: | |
- name: myTopic | |
partitions: 1 | |
replication_factor: 1 | |
roles: | |
- role: amq_streams_zookeeper | |
tasks: | |
- name: "Ensure Zookeeper is running and available." | |
ansible.builtin.include_role: | |
name: amq_streams_zookeeper | |
- name: "Ensure AMQ Streams Broker is running and available." | |
ansible.builtin.include_role: | |
name: amq_streams_broker | |
- name: "Create topics" | |
ansible.builtin.include_role: | |
name: amq_streams_broker | |
tasks_from: topic/create.yml | |
loop: "{{ amq_streams_broker_topics }}" | |
loop_control: | |
loop_var: topic | |
vars: | |
topic_name: "{{ topic.name }}" | |
topic_partitions: "{{ topic.partitions }}" | |
topic_replication_factor: "{{ topic.replication_factor }}" | |
- name: "Describe topics" | |
ansible.builtin.include_role: | |
name: amq_streams_broker | |
tasks_from: topic/describe.yml | |
loop: "{{ amq_streams_broker_topics }}" | |
loop_control: | |
loop_var: topic | |
vars: | |
topic_name: "{{ topic.name }}" | |
post_tasks: | |
- name: "Display numbers of Zookeeper instances managed by Ansible." | |
ansible.builtin.debug: | |
msg: "Numbers of Zookeeper instances: {{ amq_streams_zookeeper_instance_count }}." | |
when: | |
- amq_streams_zookeeper_instance_count_enabled is defined and amq_streams_zookeeper_instance_count_enabled | |
- name: "Display numbers of broker instances managed by Ansible." | |
ansible.builtin.debug: | |
msg: "Numbers of broker instances: {{ amq_streams_broker_instance_count }}." | |
when: | |
- amq_streams_broker_instance_count_enabled is defined and amq_streams_broker_instance_count_enabled | |
- name: "Validate that Broker deployment is functional." | |
ansible.builtin.include_role: | |
name: amq_streams_broker | |
tasks_from: validate.yml | |
- name: "Validate that deployment is functional." | |
ansible.builtin.include_role: | |
name: amq_streams_zookeeper | |
tasks_from: validate.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment