Skip to content

Commit

Permalink
Reorg plays and molecule scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
rpelisse committed Oct 10, 2023
1 parent 77c4577 commit d7dab53
Show file tree
Hide file tree
Showing 20 changed files with 696 additions and 601 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ warn_list:
- schema[tasks]
- name[missing]
- meta-runtime[unsupported-version]
- fqcn[keyword]

skip_list:
- vars_should_not_be_used
Expand Down
158 changes: 156 additions & 2 deletions molecule/all_auth/converge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,158 @@
---
- import_playbook: ../../playbooks/amq_streams_all_auth.yml
- name: "Ansible Playbook to install Zookeeper and Broker with Authentication"
hosts: all
vars:
amq_streams_common_download_dir: /tmp/
# Enabling Zookeeper Authentication
amq_streams_zookeeper_auth_enabled: true
amq_streams_zookeeper_auth_user: zkadmin
amq_streams_zookeeper_auth_pass: p@ssw0rd

# Enabling Kafka Broker Listeners
amq_streams_broker_listeners:
- AUTHENTICATED://:{{ amq_streams_broker_listener_port }}
- REPLICATION://:{{ amq_streams_broker_listener_internal_port }}

# Listener for inter-broker communications
amq_streams_broker_inter_broker_listener: REPLICATION

# Enabling Kafka Broker Authentication
amq_streams_broker_auth_enabled: true
amq_streams_broker_auth_scram_enabled: true
amq_streams_broker_auth_listeners:
- AUTHENTICATED:SASL_PLAINTEXT
- REPLICATION:PLAINTEXT

amq_streams_broker_auth_sasl_mechanisms:
- PLAIN
- SCRAM-SHA-512

# Kafka Plain Users
amq_streams_broker_auth_plain_users:
- username: admin
password: p@ssw0rd
- username: kafkauser01
password: p@ssw0rd
- username: kafkauser02
password: p@ssw0rd

# Kafka SCRAM Users
amq_streams_broker_auth_scram_users:
- username: kafkascramuser01
password: p@ssw0rd
- username: kafkascramuser02
password: p@ssw0rd

# Defining default Kafka user for administrative tasks
amq_streams_broker_admin_mechanism: PLAIN
#amq_streams_broker_admin_mechanism: SCRAM-SHA-512
amq_streams_broker_admin_username: admin
amq_streams_broker_admin_password: p@ssw0rd

# Topic Management
amq_streams_broker_topics:
- name: sampleTopic
partitions: 1
replication_factor: 1
- name: otherTopic
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
vars:
amq_streams_common_skip_download: true

- name: "Ensure Broker is running and available."
ansible.builtin.include_role:
name: amq_streams_broker
vars:
amq_streams_common_skip_download: true

- 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 }}"

- name: "Delete topics"
ansible.builtin.include_role:
name: amq_streams_broker
tasks_from: topic/delete.yml
loop: "{{ amq_streams_broker_topics }}"
loop_control:
loop_var: topic
vars:
topic_name: "{{ topic.name }}"

- name: "Create SCRAM users"
ansible.builtin.include_role:
name: amq_streams_broker
tasks_from: user-scram/create.yml
loop: "{{ amq_streams_broker_auth_scram_users }}"
loop_control:
loop_var: user
vars:
user_username: "{{ user.username }}"
user_password: "{{ user.password }}"

- name: "Describe SCRAM users"
ansible.builtin.include_role:
name: amq_streams_broker
tasks_from: user-scram/describe.yml
loop: "{{ amq_streams_broker_auth_scram_users }}"
loop_control:
loop_var: user
vars:
user_username: "{{ user.username }}"

- name: "Delete SCRAM users"
ansible.builtin.include_role:
name: amq_streams_broker
tasks_from: user-scram/delete.yml
loop: "{{ amq_streams_broker_auth_scram_users }}"
loop_control:
loop_var: user
vars:
user_username: "{{ user.username }}"

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 Zookeeper deployment is functional."
ansible.builtin.include_role:
name: amq_streams_zookeeper
tasks_from: validate.yml

- name: "Validate that Broker deployment is functional."
ansible.builtin.include_role:
name: amq_streams_broker
tasks_from: validate.yml
64 changes: 62 additions & 2 deletions molecule/all_cluster/converge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,64 @@
---
- import_playbook: ../../playbooks/amq_streams_all_cluster.yml
- name: "Ansible Playbook to install a Kafka cluster (+Zookeeper)"
hosts: all
vars:
amq_streams_common_download_dir: /tmp/
amq_streams_common_download_node: ""
amq_streams_common_download_dir: "/tmp"

# Topic Management
amq_streams_broker_topics:
- name: myTopic
partitions: 1
replication_factor: 1
roles:
- role: amq_streams_zookeeper
tasks:
- name: "Ensure AMQ Streams Broker is running and available."
ansible.builtin.include_role:
name: amq_streams_broker
vars:
amq_streams_common_skip_download: true

- 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added molecule/certs/server.truststore.jks
Binary file not shown.
12 changes: 9 additions & 3 deletions molecule/connect/converge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---
- import_playbook: ../../playbooks/amq_streams_connect.yml
vars:
amq_streams_common_download_dir: /tmp/
- name: "Ansible playbook to install a Kafka Connect cluster"
hosts: all
tasks:
- name: "Ensure Kafka Connect is running and available."
ansible.builtin.include_role:
name: amq_streams_connect
vars:
connectors:
- { name: "file", path: "connectors/file.yml" }
86 changes: 84 additions & 2 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,86 @@
---
- import_playbook: ../../playbooks/playbook.yml
- name: "Automate AMQ Streams install"
hosts: all
vars:
amq_streams_common_download_dir: /tmp/
# Topic Management
amq_streams_broker_topics:
- name: sampleTopic
partitions: 2
replication_factor: 1
- name: otherTopic
partitions: 4
replication_factor: 1
roles:
- role: amq_streams_zookeeper
tasks:
- name: "Ensure AMQ Streams Broker is running and available."
ansible.builtin.include_role:
name: amq_streams_broker
vars:
amq_streams_common_skip_download: true

- name: "Ensures topics exist."
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 created topic."
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 }}"

- name: "Delete topics"
ansible.builtin.include_role:
name: amq_streams_broker
tasks_from: topic/delete.yml
loop: "{{ amq_streams_broker_topics }}"
loop_control:
loop_var: topic
vars:
topic_name: "{{ topic.name }}"

- name: "Ensure AMQ Streams Connect is running and available."
ansible.builtin.include_role:
name: amq_streams_connect
vars:
connectors:
- { name: "file", path: "connectors/file.yml" }
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 deployment is functional."
ansible.builtin.include_role:
name: amq_streams_zookeeper
tasks_from: validate.yml

- name: "Validate that Broker deployment is functional."
ansible.builtin.include_role:
name: amq_streams_broker
tasks_from: validate.yml

- name: "Validate that Connect deployment is functional."
ansible.builtin.include_role:
name: amq_streams_connect
tasks_from: validate.yml
Loading

0 comments on commit d7dab53

Please sign in to comment.