2024-04-03 23:00:58 +02:00
|
|
|
|
|
|
|
---
|
|
|
|
- name: Ensure LDAP config is configured
|
|
|
|
ansible.builtin.command: |
|
|
|
|
forgejo admin auth add-ldap \
|
|
|
|
--config "/etc/gitea/gitea.ini" \
|
|
|
|
--name "lldap" \
|
|
|
|
--security-protocol "unencrypted" \
|
|
|
|
--host "ldap.mgrote.net" \
|
|
|
|
--port "3890" \
|
|
|
|
--bind-dn "uid=ladmin,ou=people,dc=mgrote,dc=net" \
|
|
|
|
--bind-password GEHEIM \
|
|
|
|
--user-search-base "ou=people,dc=mgrote,dc=net" \
|
|
|
|
--user-filter "(&(memberof=cn=gitea,ou=groups,dc=mgrote,dc=net)(|(uid=%[1]s)(mail=%[1]s)))" \
|
|
|
|
--username-attribute "uid" \
|
|
|
|
--email-attribute "mail" \
|
|
|
|
--firstname-attribute "givenName" \
|
|
|
|
--surname-attribute "sn" \
|
|
|
|
--avatar-attribute "jpegPhoto" \
|
|
|
|
--synchronize-users
|
|
|
|
register: configured
|
|
|
|
ignore_errors: true
|
2024-04-03 23:05:39 +02:00
|
|
|
failed_when: 'not "Command error: login source already exists [name: lldap]" in configured.stderr'
|
2024-04-03 23:03:37 +02:00
|
|
|
become_user: gitea
|
2024-04-03 23:00:58 +02:00
|
|
|
|
|
|
|
- name: debug
|
|
|
|
ansible.builtin.debug:
|
2024-04-03 23:02:18 +02:00
|
|
|
msg: "{{ configured }}"
|
2024-04-03 23:00:58 +02:00
|
|
|
|
|
|
|
- name: Modify LDAP config
|
|
|
|
ansible.builtin.command: cat /etc/motd
|
2024-04-03 23:05:39 +02:00
|
|
|
when: '"Command error: login source already exists [name: lldap]" in configured.stderr'
|
2024-04-03 23:03:37 +02:00
|
|
|
become_user: gitea
|
2024-04-03 23:00:58 +02:00
|
|
|
|
|
|
|
...
|