diff --git a/lib/ansible/inventory/host.py b/lib/ansible/inventory/host.py index a48fbce6ff..8d0fc9a52c 100644 --- a/lib/ansible/inventory/host.py +++ b/lib/ansible/inventory/host.py @@ -19,10 +19,8 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import uuid - from ansible.inventory.group import Group -from ansible.utils.vars import combine_vars +from ansible.utils.vars import combine_vars, get_unique_id __all__ = ['Host'] @@ -92,7 +90,7 @@ class Host: self._gathered_facts = False self._uuid = None if gen_uuid: - self._uuid = uuid.uuid4() + self._uuid = get_unique_id() self.implicit = False def __repr__(self): diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index 41a437c22d..3e98e57579 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -21,7 +21,6 @@ __metaclass__ = type import itertools import operator -import uuid from copy import copy as shallowcopy from functools import partial @@ -34,7 +33,7 @@ from ansible.module_utils._text import to_text from ansible.playbook.attribute import Attribute, FieldAttribute from ansible.parsing.dataloader import DataLoader from ansible.constants import mk_boolean as boolean -from ansible.utils.vars import combine_vars, isidentifier +from ansible.utils.vars import combine_vars, isidentifier, get_unique_id try: from __main__ import display @@ -184,7 +183,7 @@ class Base(with_metaclass(BaseMeta, object)): self._finalized = False # every object gets a random uuid: - self._uuid = uuid.uuid4() + self._uuid = get_unique_id() # we create a copy of the attributes here due to the fact that # it was intialized as a class param in the meta class, so we