blob: 597c97e87774c250202a67aeafbfb9f2053ce696 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
diff --git a/salt/roster/ansible.py b/salt/roster/ansible.py
index f4a2a23e0b..e6b9e80247 100644
--- a/salt/roster/ansible.py
+++ b/salt/roster/ansible.py
@@ -129,7 +129,7 @@ def targets(tgt, tgt_type='glob', **kwargs):
def _get_hosts_from_group(group):
inventory = __context__['inventory']
- hosts = [host for host in inventory[group].get('hosts', [])]
+ hosts = [host for host in inventory.setdefault(group, {}).get('hosts', [])]
for child in inventory[group].get('children', []):
hosts.extend(_get_hosts_from_group(child))
return hosts
|