Skip to content

Commit

Permalink
Remove useless when conditions and notifies
Browse files Browse the repository at this point in the history
We don't need restart apache/nginx when a php file gets updated,
they are completely separate from running configuration.

We can also drop the >= zabbix-5.0 condition.

In the rest of the role, we're only calling the respective handler
when we need to, so no more when conditions needed.
  • Loading branch information
eb4x committed Jun 10, 2024
1 parent 99dd628 commit 0d9a25d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
7 changes: 0 additions & 7 deletions roles/zabbix_web/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
state: restarted
enabled: true
become: true
when:
- zabbix_web_http_server == 'apache'

- name: test nginx config
listen: restart nginx
ansible.builtin.command: nginx -t
register: zabbix_nginx_cfg_check
notify: restart nginx tested
become: true
when:
- zabbix_web_http_server == 'nginx'

- name: restart nginx tested
ansible.builtin.service:
Expand All @@ -24,7 +20,6 @@
enabled: true
become: true
when:
- zabbix_web_http_server == 'nginx'
- zabbix_nginx_cfg_check.rc == 0

- name: restart php-fpm-version
Expand All @@ -33,8 +28,6 @@
state: restarted
enabled: true
become: true
when:
- zabbix_web_version is version('5.0', '>=')

- name: "clean repo files from proxy creds"
ansible.builtin.shell: ls /etc/yum.repos.d/zabbix* && sed -i 's/^proxy =.*//' /etc/yum.repos.d/zabbix* || true
Expand Down
2 changes: 0 additions & 2 deletions roles/zabbix_web/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@
group: "{{ zabbix_web_group }}"
mode: "{{ zabbix_web_conf_mode }}"
become: true
notify:
- "restart {{ zabbix_web_http_server }}"
tags:
- config

Expand Down

0 comments on commit 0d9a25d

Please sign in to comment.