diff --git a/tasks/main.yml b/tasks/main.yml
index 1592e37822a667d35883906012f7fb661b5827a2..099cbbaf11c37045d13df23811e29962258f252c 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -83,7 +83,7 @@
       with_items: '{{ drupal_settings|default([]) }}'
       loop_control:
         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: siteproject is not defined or siteproject == 'no' or drupal.siteproject is not defined or (siteproject == drupal.siteproject and drupal.src.git.branch == branch)
       tags:
         - collect_db_dump
         - collect_asset_archive