From fb1bc151330c5e01bc3216d0e04f723a16d36598 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sat, 28 Nov 2020 17:10:48 +0100 Subject: [PATCH] Add error message on ldap lookup --- lookup_plugins/ldap.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lookup_plugins/ldap.py b/lookup_plugins/ldap.py index 3174e79e..cdca475f 100644 --- a/lookup_plugins/ldap.py +++ b/lookup_plugins/ldap.py @@ -1,10 +1,18 @@ +""" +To use this lookup plugin, you need to pass ldap: +ssh -L 1636:172.16.10.1:636 172.16.10.1 +""" + import ipaddress from ansible.errors import AnsibleError, AnsibleParserError from ansible.plugins.lookup import LookupBase from ansible.utils.display import Display -import ldap +try: + import ldap +except ImportError: + raise AnsibleError("You need to install python3-ldap") display = Display()