tasks/ldap.yml keeps cn=Funkwhale (password from Vault, in Funkwhale Users, Postfix Users and Dovecot Users). Mail goes out as funkwhale@eom.dev instead of listmonk's news account, and the account is a Dex superuser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.3 KiB
YAML
30 lines
1.3 KiB
YAML
# SPDX-License-Identifier: MIT-0
|
|
# The service's own LDAP account (funkwhale@eom.dev): mail sender through
|
|
# postfix.eom.dev and, through Dex, the instance's admin. Done in the OpenLDAP
|
|
# pod as cn=admin, like ericomeehan.www's membership groups.
|
|
---
|
|
- name: Find the OpenLDAP pod
|
|
kubernetes.core.k8s_info:
|
|
kubeconfig: "{{ funkwhale_kubeconfig | default(omit, true) }}"
|
|
context: "{{ funkwhale_kube_context | default(omit, true) }}"
|
|
kind: Pod
|
|
namespace: "{{ funkwhale_ldap_namespace }}"
|
|
label_selectors: ["{{ funkwhale_ldap_pod_selector }}"]
|
|
field_selectors: [status.phase=Running]
|
|
register: _funkwhale_ldap_pods
|
|
failed_when: _funkwhale_ldap_pods.resources | length == 0
|
|
|
|
- name: Ensure the service's LDAP account, password and groups
|
|
kubernetes.core.k8s_exec:
|
|
kubeconfig: "{{ funkwhale_kubeconfig | default(omit, true) }}"
|
|
context: "{{ funkwhale_kube_context | default(omit, true) }}"
|
|
namespace: "{{ funkwhale_ldap_namespace }}"
|
|
pod: "{{ (_funkwhale_ldap_pods.resources | first).metadata.name }}"
|
|
command: >-
|
|
sh -c 'echo {{ lookup('ansible.builtin.template', 'ldap-account.sh.j2') | b64encode }} | base64 -d | sh'
|
|
vars:
|
|
_funkwhale_ldap_dn: "cn={{ funkwhale_ldap_account.cn }},{{ funkwhale_ldap_account.ou }}"
|
|
register: _funkwhale_ldap
|
|
changed_when: "'changed=1' in _funkwhale_ldap.stdout"
|
|
no_log: true
|