diff --git a/tasks/main.yml b/tasks/main.yml
index 0afa068ff926be2b90dcf8ea0904f096d1de8039..1682d0b3421e9d3a91a0c012a76bbf8effda89c8 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -101,4 +101,4 @@
     - name: Install tesseract
       include_tasks: tesseract.yml
 
-  when: not excluded_roles or "nextcloud" not in excluded_roles
+  when: groups.webserver_nextcloud is defined and inventory_hostname in groups.webserver_nextcloud and not excluded_roles or "nextcloud" not in excluded_roles