diff --git a/tasks/get_mac.yml b/tasks/get_mac.yml
index d9f173dc3164cf63bb16f783a1fb16e9a735fbac..b2c661d2904947e510bafb1f6a1fc2a254bf747a 100644
--- a/tasks/get_mac.yml
+++ b/tasks/get_mac.yml
@@ -7,7 +7,7 @@
     force: true
     follow: false
   when: (hostvars[item].csentry_interfaces[0].mac|string) != "None"
-  with_items: "{{ groups['{{ autoinstall_scope }}']  }}"
+  with_items: "{{ groups[(autoinstall_scope |string)]  }}"
   tags: create_link
 
 - name: create link for Mac Addr for GRUB EFI
@@ -18,5 +18,5 @@
     force: false
     follow: false
   when: (hostvars[item].csentry_interfaces[0].mac|string) != "None"
-  with_items: "{{ groups['{{ autoinstall_scope }}']  }}"
+  with_items: "{{ groups[(autoinstall_scope |string)]  }}"
   tags: create_link