- set_fact:
main_database_name: "{{ main_database_rdn.stdout | regex_replace('olcDatabase=', '', ignorecase=1) }}"
+- set_fact:
+ main_database: "{{ ansible_local.openldap_dbs[main_database_name] }}"
+
- name: "Failing because main database for suffix '{{ lapd_suffix }}' not found."
fail:
msg: "Failed to detect main database for suffix '{{ lapd_suffix }}'."
when: main_database_rdn.rc != 0
+- name: "Detecting RDN of example database:"
+ shell: "grep -P -l 'olcSuffix:\\s+{{ example_db_suffix_re }}' {{ slapd_cfg_dir }}/cn=config/olcDatabase*.ldif | xargs -i basename {} .ldif"
+ changed_when: False
+ register: example_database_rdn
+
+- set_fact:
+ example_database_name: ''
+ example_database: ~
+
+- set_fact:
+ example_database_name: "{{ example_database_rdn.stdout | regex_replace('olcDatabase=', '', ignorecase=1) }}"
+ when: example_database_rdn.stdout != ''
+
+- set_fact:
+ example_database: "{{ ansible_local.openldap_dbs[example_database_name] }}"
+ when: example_database_name != ''
+
- include: 'overlays0-memberof.yaml'
- include: 'config_root_account.yaml'