_python_ldap_prerequisites.ymlΒΆ

---
- 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