diff --git a/lib/ansible/inventory/group.py b/lib/ansible/inventory/group.py index a460b483efa..6f06cb07625 100644 --- a/lib/ansible/inventory/group.py +++ b/lib/ansible/inventory/group.py @@ -36,7 +36,7 @@ class Group(object): if self == group: raise Exception("can't add group to itself") self.child_groups.append(group) - group.depth = group.depth + 1 + group.depth = max([self.depth+1, group.depth]) group.parent_groups.append(self) def add_host(self, host):