diff --git a/modules/vagrant_generator.py b/modules/vagrant_generator.py
index 82f8ee1c6ccffbc53d74ec3eb2e7ab69e8b11c6b..83f57574611a1393d4097538dd9f6c14564c4a41 100644
--- a/modules/vagrant_generator.py
+++ b/modules/vagrant_generator.py
@@ -133,6 +133,14 @@ def _create_ansible_commands(device_name, playbook_location, input_definitions,
     groups["groups"]["routers"] = router_names
     windows_hosts = _find_windows_boxes(input_definitions)
     groups["groups"]["windows"] = windows_hosts
+    if device_name in windows_hosts:
+        windows_vars = dict()
+        windows_vars["ansible_connection"] = "\"winrm\""
+        windows_vars["ansible_user"] = "\"windows\""
+        windows_vars["ansible_password"] = "\"vagrant\""
+        windows_vars["ansible_winrm_transport"] = "\"basic\""
+        windows_vars["ansible_winrm_server_cert_validation"] = "\"ignore\""
+        groups["groups"]["windows:vars"] = windows_vars
     if "groups" in input_definitions:
         for group in input_definitions["groups"]:
             groups["groups"][group["name"]] = group["nodes"]
@@ -160,13 +168,7 @@ def _create_ansible_commands(device_name, playbook_location, input_definitions,
     extravars["type"] = "dictionary"
     extravars["command"] = "extra_vars"
     extravars["dictionary"] = dict()
-    if device_name in windows_hosts:
-        extravars["dictionary"]["ansible_connection"] = "\"winrm\""
-        extravars["dictionary"]["ansible_user"] = "\"windows\""
-        extravars["dictionary"]["ansible_password"] = "\"vagrant\""
-        extravars["dictionary"]["ansible_winrm_transport"] = "\"basic\""
-        extravars["dictionary"]["ansible_winrm_server_cert_validation"] = "\"ignore\""
-    else:
+    if device_name not in windows_hosts:
         extravars["dictionary"]["ansible_python_interpreter"] = "\"/usr/bin/python3\""
     commands.append(extravars)
 
diff --git a/templates/vagrantfile b/templates/vagrantfile
index ea7a09f6efe77fa64f24f16e2b736fbdb4d968fe..d7e09d96572abeadaf17d275e1409380b1cb5bc9 100644
--- a/templates/vagrantfile
+++ b/templates/vagrantfile
@@ -71,14 +71,29 @@
       }
 {% endmacro -%}
 
+{# Macro for group dictionaries #}
+{% macro group_dict(item, namespace) %}{
+  {% for key, value in item.items() %}
+      {% if loop.last %}
+          "{{ key }}" => {{ value }}
+      {% else %}
+          "{{ key }}" => {{ value }},
+    {% endif %}
+  {% endfor %}
+        }{% endmacro -%}
+
 {# Macro for dictionaries #}
 {% macro groups(item, namespace) %}
   {{ namespace }}.groups = {
   {% for key, value in item.groups.items() %}
-    {% if loop.last %}
-        "{{ key }}" => {{ value }}
+    {% if value is mapping %}
+        "{{ key }}" => {{ group_dict(value, namespace) }}
     {% else %}
+      {% if loop.last %}
+        "{{ key }}" => {{ value }}
+      {% else %}
         "{{ key }}" => {{ value }},
+      {% endif %}
     {% endif %}
   {% endfor %}
       }