diff --git a/tasks/main.yml b/tasks/main.yml
index 7f940730204e6ac6bfa07a7fc1d6405e830550c3..6deb8d760aa9390e9954be8092edd3e595052e3a 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -20,7 +20,7 @@
       tags:
         - ApacheConfig
 
-  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:
 
@@ -37,7 +37,7 @@
         - SetPermissions
         - mysql
 
-  when: not excluded_roles or "drupal" not in excluded_roles and drupal_install_drupal and (collect_config is not defined or not collect_config)
+  when: (not excluded_roles or "drupal" not in excluded_roles) and drupal_install_drupal and (collect_config is not defined or not collect_config)
 
 - block:
 
@@ -50,7 +50,7 @@
       tags:
         - deploy
 
-  when: not excluded_roles or "drupal" not in excluded_roles and drupal_install_drupal and collect_config is defined and collect_config
+  when: (not excluded_roles or "drupal" not in excluded_roles) and drupal_install_drupal and collect_config is defined and collect_config
 
 - block:
 
@@ -69,6 +69,6 @@
         loop_var: drupal
       when: limit_site is not defined or limit_site == 'no' or drupal.id is not defined or limit_site == drupal.id
 
-  when: not excluded_roles or "drupal" not in excluded_roles and drupal_install_drupal and collect_db_dump is defined and collect_db_dump
+  when: (not excluded_roles or "drupal" not in excluded_roles) and drupal_install_drupal and collect_db_dump is defined and collect_db_dump
   tags:
     - collect_db_dump