Skip to content
Snippets Groups Projects
Commit 77214c58 authored by Attila Farkas's avatar Attila Farkas
Browse files

Add user groups

parent 73c580e0
No related branches found
No related tags found
1 merge request!32Version 2.0.0
......@@ -149,6 +149,17 @@ class Sandbox:
self.networks)
self.controller_present: bool =\
Sandbox._controller_needed(self.devices, ansible_installed)
self.groups: Dict = Sandbox._load_groups(topology)
@classmethod
def _load_groups(cls, topology: Topology) -> Dict:
"""Load the list of user defined Ansible groups"""
groups: Dict = {}
for group in topology.groups:
groups[group.name] = group.nodes
return groups
@classmethod
def _create_network_list(cls, topology: Topology, border_router: bool,
......
......@@ -110,6 +110,11 @@ class Vagrantfile:
"ssh": Array("ssh", ssh_group),
"winrm": Array("winrm", winrm_group)}
for name, devices in sandbox.groups.items():
if name != "hosts" and name != "routers" and\
name != "ssh" and name != "winrm":
groups[name] = Array(name, devices)
return Hash("ansible_groups", groups)
@staticmethod
......@@ -158,7 +163,8 @@ class Vagrantfile:
group: Optional[str] = None) -> List:
"""Add attributes to provisioning"""
attributes: List = [String("playbook",
sandbox.config["provisioning_playbook"])]
sandbox.config["provisioning_playbook"]),
Variable("groups", "ansible_groups")]
if sandbox.verbose_ansible:
attributes.append(String("verbose", "vv"))
if sandbox.extra_vars is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment