diff --git a/roles/amq_streams_broker/tasks/main.yml b/roles/amq_streams_broker/tasks/main.yml index 1990df0..63d0658 100644 --- a/roles/amq_streams_broker/tasks/main.yml +++ b/roles/amq_streams_broker/tasks/main.yml @@ -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: @@ -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 diff --git a/roles/amq_streams_broker/tasks/prereqs.yml b/roles/amq_streams_broker/tasks/prereqs.yml deleted file mode 100644 index 6c39ed0..0000000 --- a/roles/amq_streams_broker/tasks/prereqs.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- 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) }}" diff --git a/roles/amq_streams_connect/tasks/main.yml b/roles/amq_streams_connect/tasks/main.yml index 428e673..75f17f4 100644 --- a/roles/amq_streams_connect/tasks/main.yml +++ b/roles/amq_streams_connect/tasks/main.yml @@ -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: diff --git a/roles/amq_streams_connect/tasks/prereqs.yml b/roles/amq_streams_connect/tasks/prereqs.yml deleted file mode 100644 index 45be44b..0000000 --- a/roles/amq_streams_connect/tasks/prereqs.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- 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 }}" diff --git a/roles/amq_streams_cruise_control/defaults/main.yml b/roles/amq_streams_cruise_control/defaults/main.yml index fdd6d3d..b1c53e7 100644 --- a/roles/amq_streams_cruise_control/defaults/main.yml +++ b/roles/amq_streams_cruise_control/defaults/main.yml @@ -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' diff --git a/roles/amq_streams_cruise_control/tasks/main.yml b/roles/amq_streams_cruise_control/tasks/main.yml index 851d1a1..9b33610 100644 --- a/roles/amq_streams_cruise_control/tasks/main.yml +++ b/roles/amq_streams_cruise_control/tasks/main.yml @@ -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 @@ -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: @@ -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 diff --git a/roles/amq_streams_cruise_control/tasks/service.yml b/roles/amq_streams_cruise_control/tasks/service.yml new file mode 100644 index 0000000..8509dcf --- /dev/null +++ b/roles/amq_streams_cruise_control/tasks/service.yml @@ -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('') }}" diff --git a/roles/amq_streams_zookeeper/tasks/main.yml b/roles/amq_streams_zookeeper/tasks/main.yml index 1323413..c887791 100644 --- a/roles/amq_streams_zookeeper/tasks/main.yml +++ b/roles/amq_streams_zookeeper/tasks/main.yml @@ -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: @@ -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 }}" diff --git a/roles/amq_streams_zookeeper/tasks/prereqs.yml b/roles/amq_streams_zookeeper/tasks/prereqs.yml deleted file mode 100644 index f1b8373..0000000 --- a/roles/amq_streams_zookeeper/tasks/prereqs.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- 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 }}"