From f623e96cceacc223bbeca56d1f0ee1a14f34dd61 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 20 Oct 2020 17:14:05 +0200 Subject: [PATCH] Finishing Installation OpenLDAP --- roles/base/tasks/consumers.yaml | 2 +- roles/base/tasks/consumers_per_db.yaml | 12 ++++++++++-- roles/base/templates/syncrepl.ldif.j2 | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/roles/base/tasks/consumers.yaml b/roles/base/tasks/consumers.yaml index 76d5a52..9c27fc6 100644 --- a/roles/base/tasks/consumers.yaml +++ b/roles/base/tasks/consumers.yaml @@ -3,8 +3,8 @@ - name: "Acticvating SyncRepl consumers for databases ..." include_tasks: "consumers_per_db.yaml" loop: - - '{0}config' - "{{ main_database_name }}" + - '{0}config' loop_control: loop_var: database_name diff --git a/roles/base/tasks/consumers_per_db.yaml b/roles/base/tasks/consumers_per_db.yaml index e65df01..d9b9f7d 100644 --- a/roles/base/tasks/consumers_per_db.yaml +++ b/roles/base/tasks/consumers_per_db.yaml @@ -11,6 +11,14 @@ db_suffix: "{{ ansible_local.openldap_dbs[database_name].suffix }}" when: database_name != '{0}config' +- set_fact: + search_base: 'cn=schema,cn=config' + when: database_name == '{0}config' + +- set_fact: + search_base: "{{ db_suffix }}" + when: database_name != '{0}config' + - set_fact: bind_dn: "{{ admin_bind_dn_prefix }},{{ db_suffix }}" @@ -51,8 +59,8 @@ - name: "Show content of applying SyncRepl consumers file." debug: msg={{ content_syncrepl_file.stdout_lines }} - # name: "Applying SyncRepl consumers file at the end ..." - # shell: "ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f '{{ syncrepl_file.path }}'" + - name: "Applying SyncRepl consumers file at the end ..." + shell: "ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f '{{ syncrepl_file.path }}'" rescue: - name: "Failing base installation of OpenLDAP server because of some errors." diff --git a/roles/base/templates/syncrepl.ldif.j2 b/roles/base/templates/syncrepl.ldif.j2 index 4123c22..2d915e0 100644 --- a/roles/base/templates/syncrepl.ldif.j2 +++ b/roles/base/templates/syncrepl.ldif.j2 @@ -6,7 +6,7 @@ olcSyncRepl: rid={{ rid_one }}{{ db_id_token }} binddn="{{ bind_dn }}" bindmethod=simple credentials="{{ admin_password }}" - searchbase="{{ db_suffix }}" + searchbase="{{ search_base }}" type=refreshAndPersist retry="{{ repl_retry }}" tls_reqcert=never @@ -16,7 +16,7 @@ olcSyncRepl: rid={{ rid_two }}{{ db_id_token }} binddn="{{ bind_dn }}" bindmethod=simple credentials="{{ admin_password }}" - searchbase="{{ db_suffix }}" + searchbase="{{ search_base }}" type=refreshAndPersist retry="{{ repl_retry }}" tls_reqcert=never -- 2.39.5