redeployment forgejo + setup ldap #1

Merged
mg merged 123 commits from gb into master 2024-04-04 09:48:10 +02:00
Showing only changes of commit 9f6c24b319 - Show all commits

View file

@ -1,6 +1,6 @@
---
- name: Ensure LDAP config is configured
- name: Ensure LDAP config is set up
ansible.builtin.command: |
forgejo admin auth add-ldap \
--config "/etc/gitea/gitea.ini" \
@ -18,15 +18,15 @@
--surname-attribute "sn" \
--avatar-attribute "jpegPhoto" \
--synchronize-users
register: configured
register: setup
ignore_errors: true
failed_when: 'not "Command error: login source already exists [name: lldap]" in configured.stderr'
failed_when: 'not "Command error: login source already exists [name: lldap]" in setup.stderr' # fail Task wenn LDAP schon konfiguriert ist
become_user: gitea
changed_when: "configured.rc == 0"
changed_when: "setup.rc == 0" # chnaged nur wenn Task rc 0 hat, sollte nur beim ersten lauf vorkommen; ungetestet
- name: debug
ansible.builtin.debug:
msg: "{{ configured }}"
msg: "{{ setup }}"
- name: Modify LDAP config
ansible.builtin.command: |
@ -46,9 +46,10 @@
--surname-attribute "sn" \
--avatar-attribute "jpegPhoto" \
--synchronize-users
when: '"Command error: login source already exists [name: lldap]" in configured.stderr'
when: '"Command error: login source already exists [name: lldap]" in setup.stderr' # führe nur aus wenn erster Task fehlgeschlagen ist
become_user: gitea
register: zwei
changed_when: "setup.stdout | length > 0" # changed wenn stdout nciht lerr ist
- name: debug
ansible.builtin.debug: