diff --git a/tasks/main.yml b/tasks/main.yml
index a71572b147f751b340c7c2c6023cf1826a52ce26..f96bf04cff0a5819e41b163008caa6b9312e51e5 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -27,4 +27,4 @@
       tags:
         - always
 
-  when: not excluded_roles or "zabbix_agent" not in excluded_roles and role_zabbix_agent_completed is not defined
+  when: (not excluded_roles or "zabbix_agent" not in excluded_roles) and role_zabbix_agent_completed is not defined