Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rpelisse committed Jan 9, 2024
1 parent 604b101 commit 52eddc5
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 76 deletions.
16 changes: 13 additions & 3 deletions roles/amq_streams_broker/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
---
- name: "Ensure requirements for broker are fulfilled."
ansible.builtin.include_tasks: prereqs.yml
- name: "Ensure prerequirements for collection are met."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: prereqs.yml
vars:
prereqs_user: "{{ amq_streams_broker_user }}"
prereqs_group: "{{ amq_streams_broker_group }}"

- name: "Set Zookeeper host value"
ansible.builtin.set_fact:
amq_streams_broker_zookeeper_host: "{{ amq_streams_zookeeper_host | default(amq_streams_broker_zookeeper_host_default_value) }}"
amq_streams_broker_zookeeper_port: "{{ amq_streams_zookeeper_port | default(amq_streams_broker_zookeeper_port_default_value) }}"

- name: "Ensure Prometheus requirements are met (if enabled: {{ amq_streams_broker_prometheus_enabled }})."
ansible.builtin.include_role:
Expand Down Expand Up @@ -95,5 +105,5 @@
when:
- amq_streams_broker_tls_enabled is defined and amq_streams_broker_tls_enabled

- name: "Configure firewalld for Broker (if enable)."
- name: "Configure service for Broker (if enable)."
ansible.builtin.include_tasks: service.yml
13 changes: 0 additions & 13 deletions roles/amq_streams_broker/tasks/prereqs.yml

This file was deleted.

9 changes: 7 additions & 2 deletions roles/amq_streams_connect/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
- amq_streams_common_home is defined
quiet: true

- name: "Ensure prerequisite are fullfilled."
ansible.builtin.include_tasks: prereqs.yml
- name: "Ensure user and group exists (if provided)."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: prereqs.yml
vars:
prereqs_user: "{{ amq_streams_connect_user }}"
prereqs_group: "{{ amq_streams_connect_group }}"

- name: "Ensure OS has been properly tuned (RHEL specific)."
ansible.builtin.include_role:
Expand Down
8 changes: 0 additions & 8 deletions roles/amq_streams_connect/tasks/prereqs.yml

This file was deleted.

5 changes: 3 additions & 2 deletions roles/amq_streams_cruise_control/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
amq_streams_cruise_control_enabled: false
amq_streams_cruise_control_home: /opt/cruise-control/
rhn_product_archive_file_pattern: '^.*/amq-streams-[0-9.]*-cruise-control-bin.zip'
amq_streams_cruise_control_rhn_product_archive_file_pattern: '^.*/amq-streams-[0-9.]*-cruise-control-bin.zip'
amq_streams_cruise_control_service_name: amq_streams_cruise_control
amq_streams_cruise_control_server_start: "{{ amq_streams_cruise_control_home }}/kafka-cruise-control-start.sh"
amq_streams_cruise_control_server_stop: "{{ amq_streams_cruise_control_home }}/kafka-cruise-control-stop.sh"
amq_streams_common_archive_file: amq-streams-2.5.1-cruise-control-bin.zip
amq_streams_cruise_control_version: 2.5.1
amq_streams_cruise_control_archive_file: "amq-streams-{{ amq_streams_cruise_control_version }}-cruise-control-bin.zip"
amq_streams_cruise_control_server_config: "/etc/amq_streams_cruise_control.properties"
amq_streams_cruise_control_config_template: 'templates/service.conf.j2'
amq_streams_cruise_control_config_properties_template: 'templates/cruisecontrol.properties.j2'
Expand Down
44 changes: 7 additions & 37 deletions roles/amq_streams_cruise_control/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- amq_stream_cruise_control_home is defined
quiet: true

- name: "Ensure Cruise Control artifacts are available."
- name: "Ensure requirements for Cruise Control are met."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: main.yml
Expand All @@ -15,13 +15,14 @@
name: amq_streams_common
tasks_from: rhn/main.yml

- name: "Ensure Cruise Control artifacts are available."
- name: "Ensure Cruise Control artifacts is properly installed."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: install.yml
vars:
amq_streams_common_archive_file: amq-streams-2.5.1-cruise-control-bin.zip
amq_streams_common_archive_creates_control_file: /opt/cruise-control//config
amq_streams_common_archive_file: "{{ amq_streams_cruise_control_archive_file }}"
amq_streams_common_archive_creates_control_file: "{{ amq_streams_cruise_control_home }}/config"
rhn_product_archive_file_pattern: "{{ amq_streams_cruise_control_rhn_product_archive_file_pattern }}"

- name: "Deploy custom log4j config (if provided)"
when:
Expand Down Expand Up @@ -50,36 +51,5 @@
when:
- amq_streams_broker_inter_broker_auth_sasl_protocol is defined and amq_streams_broker_inter_broker_auth_sasl_mechanisms is defined and amq_streams_cruise_control_zk_sasl_jaas_config is defined

- name: "Configure firewalld for Cruise Control (if enable)."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: firewalld.yml
vars:
service_port: "{{ amq_streams_cruise_control_port }}"
when:
- amq_streams_firewalld_enabled is defined and amq_streams_firewalld_enabled
- amq_streams_cruise_control_port is defined

- name: "Deploy Cruise Control as a systemd service."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: systemd.yml
vars:
# service_systemd_workdir: "{{ amq_streams_common_home }}"
server_name: "{{ amq_streams_cruise_control_service_name }}"
server_start: "{{ amq_streams_cruise_control_server_start }}"
server_stop: "{{ amq_streams_cruise_control_server_stop }}"
server_config: "{{ amq_streams_cruise_control_server_config }}"
server_config_template: "{{ amq_streams_cruise_control_config_properties_template }}"
# service_systemd_env_file: "{{ amq_streams_connect_systemd_env_file }}"
# service_systemd_env_file_template: "{{ amq_streams_connect_service_config_template }}"
# server_log_dir: "{{ amq_streams_connect_logs_dir | default(omit) }}"
# server_extra_args: "{{ amq_streams_connect_server_extra_args }}"
server_user: "{{ amq_streams_cruise_control_user }}"
server_group: "{{ amq_streams_cruise_control_group }}"
server_java_opts: "{{ amq_streams_cruise_control_java_opts | default('') }}"
# server_log4j_opts: "{{ amq_streams_connect_java_log4j_opts | default('') }}"
# server_java_heap_opts: "{{ amq_streams_connect_java_heap_opts | default('') }}"
# server_java_performance_opts: "{{ amq_streams_connect_java_performance_opts | default('') }}"
# server_java_gc_log_opts: "{{ amq_streams_connect_java_java_gc_log_opts | default('') }}"
# server_start_sleep: "{{ amq_streams_connect_zookeeper_session_timeout_ms }}"
- name: "Ensure Cruise Control service is running (if enable)."
ansible.builtin.include_tasks: service.yml
24 changes: 24 additions & 0 deletions roles/amq_streams_cruise_control/tasks/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- name: "Configure firewalld for Cruise Control (if enable)."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: firewalld.yml
vars:
service_port: "{{ amq_streams_cruise_control_port }}"
when:
- amq_streams_firewalld_enabled is defined and amq_streams_firewalld_enabled
- amq_streams_cruise_control_port is defined

- name: "Deploy Cruise Control as a systemd service."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: systemd.yml
vars:
server_name: "{{ amq_streams_cruise_control_service_name }}"
server_start: "{{ amq_streams_cruise_control_server_start }}"
server_stop: "{{ amq_streams_cruise_control_server_stop }}"
server_config: "{{ amq_streams_cruise_control_server_config }}"
server_config_template: "{{ amq_streams_cruise_control_config_properties_template }}"
server_user: "{{ amq_streams_cruise_control_user }}"
server_group: "{{ amq_streams_cruise_control_group }}"
server_java_opts: "{{ amq_streams_cruise_control_java_opts | default('') }}"
11 changes: 8 additions & 3 deletions roles/amq_streams_zookeeper/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
- name: "Ensure requirements for Zookeeper are present."
ansible.builtin.include_tasks: prereqs.yml
- name: "Ensure user for zookeeper exists (if provided)."
ansible.builtin.include_role:
name: amq_streams_common
tasks_from: prereqs.yml
vars:
prereqs_user: "{{ amq_streams_zookeeper_user }}"
prereqs_group: "{{ amq_streams_zookeeper_group }}"

- name: "Ensure OS has been properly tuned (RHEL specific)."
ansible.builtin.include_role:
Expand Down Expand Up @@ -45,7 +50,7 @@
- amq_streams_zookeeper_inventory_group is defined
- amq_streams_zookeeper_inventory_group | length > 0

- name: "Configure Zookeeper authentication"
- name: "Configure Zookeeper authentication (if enabled)"
ansible.builtin.template:
src: "{{ amq_streams_zookeeper_auth_config_template }}"
dest: "{{ amq_streams_zookeeper_auth_config }}"
Expand Down
8 changes: 0 additions & 8 deletions roles/amq_streams_zookeeper/tasks/prereqs.yml

This file was deleted.

0 comments on commit 52eddc5

Please sign in to comment.