diff --git a/tasks/main.yml b/tasks/main.yml
index 67261a462763f9beeedb49fa7f8e01aad9f9fb44..5611673285bb0a006997683c0ad4ad25c77efeae 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -16,7 +16,7 @@
         loop_var: domain
       when: domain.protocol|default("https") == "https" and domain.letsencrypt|default(true)
 
-  when: not excluded_roles or "letsencrypt" not in excluded_roles and groups.proxyserver is not defined
+  when: (not excluded_roles or "letsencrypt" not in excluded_roles) and groups.proxyserver is not defined
 
 - block: