diff --git a/ansible/roles/openvswitch/tasks/config.yml b/ansible/roles/openvswitch/tasks/config.yml
index e32c76ec4c47121a91fa1d2bb31622344710b29f..7abfd58061521c233fe07fe38caf0fd556895619 100644
--- a/ansible/roles/openvswitch/tasks/config.yml
+++ b/ansible/roles/openvswitch/tasks/config.yml
@@ -34,7 +34,7 @@
     dest: "{{ node_config_directory }}/openvswitch-vswitchd/start-ovs"
     mode: "0770"
   when:
-    - inventory_hostname in groups[service.group]
+    - service.host_in_groups | bool
     - service.enabled | bool
   notify:
     - "Restart openvswitch-vswitchd container"
@@ -48,7 +48,7 @@
     dest: "{{ node_config_directory }}/openvswitch-db-server/start-ovsdb-server"
     mode: "0770"
   when:
-    - inventory_hostname in groups[service.group]
+    - service.host_in_groups | bool
     - service.enabled | bool
   notify:
     - "Restart openvswitch-db-server container"