Commit c647a3f8 authored by nimrod's avatar nimrod
Browse files

Changed olcTLS attributes set from with_items to with_dict and run it twice...

Changed olcTLS attributes set from with_items to with_dict and run it twice (first time with ignore_errors), but at least it's seems to work reliably on both first run and subsequent runs.
parent 5a51080e
Loading
Loading
Loading
Loading
+22 −11
Changes for tasks/main.yml: 22 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -56,22 +56,33 @@
    dn: 'olcDatabase={1}{{ slapd_backend }},cn=config'
    name: olcAccess
    values: '{1}to attrs=loginShell,gecos by dn="cn=admin,{{ openldap_basedn }}" write by self write by * read'
    state: present

- name: Configure olcTLS attributes (first time, can fail)
  ignore_errors: yes
  with_dict:
    olcTLSCACertificateFile: '{{ openldap_tls_ca_cert }}'
    olcTLSCertificateFile: '{{ openldap_tls_cert }}'
    olcTLSCertificateKeyFile: '{{ openldap_tls_key }}'
    olcTLSCipherSuite: '+AES-128-GCM:+AES-256-GCM:+AES-128-CBC:+AES-256-CBC:+ECDHE-RSA:+DHE-RSA:+AEAD:+SHA1:+SHA256:+SHA384'
  ldap_attr:
    dn: 'cn=config'
    name: '{{ item.key }}'
    values: '{{ item.value }}'
    state: exact
  notify:
    - Restart OpenLDAP

- name: Configure olcTLS attributes
  with_items:
  - name: olcTLSCertificateFile
    values: '{{ openldap_tls_cert }}'
  - name: olcTLSCertificateKeyFile
    values: '{{ openldap_tls_key }}'
  - name: olcTLSCACertificateFile
    values: '{{ openldap_tls_ca_cert }}'
  - name: olcTLSCipherSuite
    values: '+AES-128-GCM:+AES-256-GCM:+AES-128-CBC:+AES-256-CBC:+ECDHE-RSA:+DHE-RSA:+AEAD:+SHA1:+SHA256:+SHA384'
  with_dict:
    olcTLSCACertificateFile: '{{ openldap_tls_ca_cert }}'
    olcTLSCertificateFile: '{{ openldap_tls_cert }}'
    olcTLSCertificateKeyFile: '{{ openldap_tls_key }}'
    olcTLSCipherSuite: '+AES-128-GCM:+AES-256-GCM:+AES-128-CBC:+AES-256-CBC:+ECDHE-RSA:+DHE-RSA:+AEAD:+SHA1:+SHA256:+SHA384'
  ldap_attr:
    dn: 'cn=config'
    name: '{{ item.name }}'
    values: '"{{ item.values }}"'
    name: '{{ item.key }}'
    values: '{{ item.value }}'
    state: exact
  notify:
    - Restart OpenLDAP