summaryrefslogtreecommitdiff
path: root/roles/mail/postfix/submission/tasks/saslauthd-ldap.yml
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-07-10 18:00:32 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-07-10 18:00:32 +0200
commit63a3ecbe58c2bb192c5693af3939eb9e29877e65 (patch)
tree7b0eace6670557a6154f8930342c883c28b115ed /roles/mail/postfix/submission/tasks/saslauthd-ldap.yml
parentmove postfix rules to mail subdir (diff)
add extended postfix roles
Diffstat (limited to 'roles/mail/postfix/submission/tasks/saslauthd-ldap.yml')
-rw-r--r--roles/mail/postfix/submission/tasks/saslauthd-ldap.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/roles/mail/postfix/submission/tasks/saslauthd-ldap.yml b/roles/mail/postfix/submission/tasks/saslauthd-ldap.yml
new file mode 100644
index 00000000..55f1ece9
--- /dev/null
+++ b/roles/mail/postfix/submission/tasks/saslauthd-ldap.yml
@@ -0,0 +1,29 @@
+---
+- name: prepare ldap options for salsauthd
+ set_fact:
+ saslauthd_ldap_options: "{{ postfix_submission_auth_saslauthd.ldap_options }}"
+
+- name: install and configure ldap server certificate
+ when: "'tls_cacert_file' in postfix_submission_auth_saslauthd.ldap_options or 'tls_cacert_content' in postfix_submission_auth_saslauthd.ldap_options"
+ block:
+ - name: install ldap server certificate
+ copy:
+ src: "{{ postfix_submission_auth_saslauthd.ldap_options.tls_cacert_file | default(omit) }}"
+ content: "{{ postfix_submission_auth_saslauthd.ldap_options.tls_cacert_content | default(omit) }}"
+ dest: /etc/saslauthd-ldapscert.pem
+ notify: restart saslauthd
+
+ - name: update ca certificate file path in ldap options
+ set_fact:
+ saslauthd_ldap_options: "{{ saslauthd_ldap_options | combine({'tls_cacert_file': '/etc/saslauthd-ldapscert.pem'}) }}"
+
+- name: generate salsuathd config for ldap
+ copy:
+ content: |
+ {% for option,value in saslauthd_ldap_options.items() %}
+ {% if option != 'tls_cacert_content' %}
+ ldap_{{ option }}: {{ value }}
+ {% endif %}
+ {% endfor %}
+ dest: /etc/saslauthd.conf
+ notify: restart saslauthd