79450913

Date: 2025-02-19 10:06:28
Score: 0.5
Natty:
Report link

I found the answer... it wasn't the command at all, it was the environment variable!!

So, when I took the env variable away from the start of the command it ran the ldapsearch successfully. Then I was able to set the env var as follows :

  - name: Directory | Run LDAP search to confirm bind user can access backend
    command: "/bin/ldapsearch -LLL -o ldif-wrap=no -x -H ldaps://directory-host:1636 -D uid=ServiceUsr,ou=Applications,dc=acme,dc=com -w xxxxx -b dc=acme,dc=com 'objectclass=organizationalunit' dn"
    become: yes
    become_user: root
    register: ldap_search_result
    failed_when: ldap_search_result.rc != 0
    environment:
      LDAPTLS_REQCERT: 'never'

  - name: Directory | Test ldapsearch output
    debug:
      var: ldap_search_result.stdout_lines
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: darrensunley