diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_permissions_facts.py b/lib/ansible/modules/cloud/ovirt/ovirt_permissions_facts.py index a8bee8102c5..030d6c006e1 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_permissions_facts.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_permissions_facts.py @@ -94,7 +94,12 @@ from ansible.module_utils.ovirt import ( def _permissions_service(connection, module): if module.params['user_name']: service = connection.system_service().users_service() - entity = search_by_name(service, module.params['user_name']) + entity = next(iter(service.list(search='usrname={}'.format( + '{}@{}'.format(module.params['user_name'], module.params['authz_name']) + ) + )), + None + ) else: service = connection.system_service().groups_service() entity = search_by_name(service, module.params['group_name']) @@ -125,6 +130,7 @@ def main(): for key, value in p.__dict__.items(): if value and isinstance(value, sdk.Struct): newperm[key[1:]] = get_link_name(connection, value) + newperm['%s_id' % key[1:]] = value.id permissions.append(newperm) module.exit_json(