---
# Tasks specific for Suse systems

# SLES 15 comes with openjdk-11 by default.
# In order for the zabbix-java-gateway to work, we need to install openjdk-17.
- name: "Suse | Install openjdk-{{ zabbix_javagateway_openjdk_version }}"
  ansible.builtin.package:
    pkg:
      - java-{{ zabbix_javagateway_openjdk_version }}-openjdk-headless
      - java-{{ zabbix_javagateway_openjdk_version }}-openjdk
    state: "{{ zabbix_javagateway_package_state }}"
  environment:
    http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}"
    https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}"
  register: zabbix_java_gateway_install
  until: zabbix_java_gateway_install is succeeded
  become: true
  tags:
    - install

- name: "Suse | Installing zabbix-java-gateway"
  ansible.builtin.package:
    pkg: zabbix-java-gateway
    state: "{{ zabbix_javagateway_package_state }}"
  environment:
    http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}"
    https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}"
  register: zabbix_java_gateway_install
  until: zabbix_java_gateway_install is succeeded
  become: true
  tags:
    - install
