---
# Tasks specific for RedHat systems

- name: "RedHat | Installing zabbix-java-gateway"
  ansible.builtin.package:
    pkg: zabbix-java-gateway
    state: "{{ zabbix_javagateway_package_state }}"
    disablerepo: "{{ zabbix_agent_disable_repo | default(omit) }}"
  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: "RedHat | Looking for Enviroment Files (See Issue 1474)"
  ansible.builtin.find:
    path: /etc/zabbix/
    patterns: '*.env'
  register: _env_files

- name: "RedHat | Create Enviroment File (See Issue 1474)"
  ansible.builtin.file:
    path: /etc/zabbix/zabbix_java_gateway.env
    state: touch
    owner: root
    group: root
    mode: 644
  when: _env_files['matched'] == 0
