diff --git a/molecule/zabbix_web/prepare.yml b/molecule/zabbix_web/prepare.yml index 935799eb4..d8bfcefc0 100644 --- a/molecule/zabbix_web/prepare.yml +++ b/molecule/zabbix_web/prepare.yml @@ -199,6 +199,12 @@ - ansible_distribution_major_version >= '22' - ansible_os_family == "Debian" + - name: Set PHP Version (Suse) + ansible.builtin.set_fact: + __php_default_version_suse: "8" + when: + - ansible_os_family == "Suse" + roles: - role: geerlingguy.apache when: diff --git a/roles/zabbix_web/handlers/main.yml b/roles/zabbix_web/handlers/main.yml index e97787b12..9086ca546 100644 --- a/roles/zabbix_web/handlers/main.yml +++ b/roles/zabbix_web/handlers/main.yml @@ -34,6 +34,17 @@ enabled: true become: true when: + - ansible_os_family == 'Debian' + - zabbix_web_version is version('5.0', '>=') + +- name: restart php-fpm + ansible.builtin.service: + name: php-fpm + state: restarted + enabled: true + become: true + when: + - ansible_os_family == 'Suse' - zabbix_web_version is version('5.0', '>=') - name: "clean repo files from proxy creds" diff --git a/roles/zabbix_web/tasks/apache.yml b/roles/zabbix_web/tasks/apache.yml index 7e55fe3e9..597719b20 100644 --- a/roles/zabbix_web/tasks/apache.yml +++ b/roles/zabbix_web/tasks/apache.yml @@ -37,6 +37,19 @@ until: zabbix_apache_conf_install is succeeded become: true when: ansible_os_family == "RedHat" + + - name: "Suse | Install zabbix-apache-conf" + ansible.builtin.package: + pkg: zabbix-apache-conf + state: "{{ zabbix_web_package_state }}" + update_cache: true + environment: + http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}" + https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}" + register: zabbix_apache_conf_install + until: zabbix_apache_conf_install is succeeded + become: true + when: ansible_os_family == "Suse" tags: - install diff --git a/roles/zabbix_web/tasks/main.yml b/roles/zabbix_web/tasks/main.yml index b82d8486b..a589841cf 100644 --- a/roles/zabbix_web/tasks/main.yml +++ b/roles/zabbix_web/tasks/main.yml @@ -80,7 +80,7 @@ tags: - config -- name: "Debian | Install PHP" +- name: "Debian / Suse | Install PHP" ansible.builtin.template: src: php-fpm.conf.j2 dest: "{{ zabbix_php_fpm_dir }}/zabbix.conf" @@ -90,8 +90,9 @@ become: true when: - zabbix_web_create_php_fpm - - ansible_os_family == "Debian" + - ansible_os_family in ["Debian", "Suse"] notify: - restart php-fpm-version + - restart php-fpm tags: - config diff --git a/roles/zabbix_web/tasks/nginx.yml b/roles/zabbix_web/tasks/nginx.yml index 1f50263ca..55ac281ba 100644 --- a/roles/zabbix_web/tasks/nginx.yml +++ b/roles/zabbix_web/tasks/nginx.yml @@ -40,6 +40,19 @@ until: zabbix_apache_conf_install is succeeded become: true when: ansible_os_family == "RedHat" + + - name: "Suse | Install zabbix-nginx-conf" + ansible.builtin.package: + pkg: zabbix-nginx-conf + state: "{{ zabbix_web_package_state }}" + update_cache: true + environment: + http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}" + https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}" + register: zabbix_apache_conf_install + until: zabbix_apache_conf_install is succeeded + become: true + when: ansible_os_family == "Suse" tags: - install diff --git a/roles/zabbix_web/templates/apache_vhost.conf.j2 b/roles/zabbix_web/templates/apache_vhost.conf.j2 index 334861d9b..fc7086669 100644 --- a/roles/zabbix_web/templates/apache_vhost.conf.j2 +++ b/roles/zabbix_web/templates/apache_vhost.conf.j2 @@ -36,7 +36,7 @@ DirectoryIndex index.php -{% if ansible_os_family == "RedHat" %} +{% if ansible_os_family in ["RedHat", "Suse"] %} SetHandler "proxy:unix:{{ zabbix_php_fpm_listen }}|fcgi://localhost" @@ -118,7 +118,7 @@ SSLRandomSeed connect builtin DirectoryIndex index.php -{% if ansible_os_family == "RedHat" %} +{% if ansible_os_family in ["RedHat", "Suse"] %} SetHandler "proxy:unix:{{ zabbix_php_fpm_listen }}|fcgi://localhost" diff --git a/roles/zabbix_web/templates/php-fpm.conf.j2 b/roles/zabbix_web/templates/php-fpm.conf.j2 index e6b02cc9e..42860443d 100644 --- a/roles/zabbix_web/templates/php-fpm.conf.j2 +++ b/roles/zabbix_web/templates/php-fpm.conf.j2 @@ -3,7 +3,7 @@ user = {{ zabbix_php_fpm_conf_user if zabbix_php_fpm_conf_user is defined else z group = {{ zabbix_php_fpm_conf_group if zabbix_php_fpm_conf_group is defined else zabbix_web_group }} listen = {{ zabbix_php_fpm_listen }} -{% if zabbix_php_fpm_conf_listen and ansible_os_family != 'Debian' %} +{% if zabbix_php_fpm_conf_listen and ansible_os_family not in ['Debian', 'Suse'] %} listen.acl_users = {{ zabbix_php_fpm_conf_user if zabbix_php_fpm_conf_user is defined else zabbix_web_user }} {% endif %} listen.owner = {{ zabbix_php_fpm_conf_user if zabbix_php_fpm_conf_user is defined else zabbix_web_user }} diff --git a/roles/zabbix_web/vars/Suse.yml b/roles/zabbix_web/vars/Suse.yml index f168fdee0..8093d580f 100644 --- a/roles/zabbix_web/vars/Suse.yml +++ b/roles/zabbix_web/vars/Suse.yml @@ -5,8 +5,8 @@ _apache_log: apache2 _apache_service: apache2 _apache_vhost_location: /etc/apache2/conf.d/zabbix.conf -_php_fpm_dir: /etc/php-fpm.d -_php_fpm_session: /var/lib/php/session +_php_fpm_dir: "/etc/php8/fpm/php-fpm.d" +_php_fpm_session: /var/lib/php8/sessions _zabbix_php_fpm_listen: /run/php-fpm/zabbix.sock _nginx_user: nginx