diff --git a/changelogs/fragments/3667-ldap_search.yml b/changelogs/fragments/3667-ldap_search.yml new file mode 100644 index 0000000000..2b155aefa5 --- /dev/null +++ b/changelogs/fragments/3667-ldap_search.yml @@ -0,0 +1,2 @@ +bugfixes: + - ldap_search - allow it to be used even in check mode (https://github.com/ansible-collections/community.general/issues/3619). diff --git a/plugins/modules/net_tools/ldap/ldap_search.py b/plugins/modules/net_tools/ldap/ldap_search.py index 6b83321ff9..d3378646ac 100644 --- a/plugins/modules/net_tools/ldap/ldap_search.py +++ b/plugins/modules/net_tools/ldap/ldap_search.py @@ -106,11 +106,10 @@ def main(): module.fail_json(msg=missing_required_lib('python-ldap'), exception=LDAP_IMP_ERR) - if not module.check_mode: - try: - LdapSearch(module).main() - except Exception as exception: - module.fail_json(msg="Attribute action failed.", details=to_native(exception)) + try: + LdapSearch(module).main() + except Exception as exception: + module.fail_json(msg="Attribute action failed.", details=to_native(exception)) module.exit_json(changed=False)