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