--- - name: 📦 Install python-ldap native library build dependencies package_install: id: openldap-dev - name: 🔍 Resolve Python include directory for active interpreter ansible.builtin.command: argv: - "{{ ansible_python_interpreter }}" - -c - import sysconfig; print(sysconfig.get_paths()['include']) register: openldap_python_include_dir changed_when: false - name: 🔧 Set Python.h path for active interpreter ansible.builtin.set_fact: openldap_python_header_path: "{{ (openldap_python_include_dir.stdout | trim) ~ '/Python.h' }}" changed_when: false - name: 🔎 Check whether Python.h exists for active interpreter ansible.builtin.stat: path: "{{ openldap_python_header_path }}" register: openldap_python_header