mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Huge role refactoring/cleanup. Other commits will propably follow. Because some bugs will exist. Still important for longrun and also for auto docs/help/slideshow generation
This commit is contained in:
42
roles/web-app-gitea/tasks/setup/ldap.yml
Normal file
42
roles/web-app-gitea/tasks/setup/ldap.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
- name: "Add LDAP Authentication Source"
|
||||
shell: |
|
||||
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
||||
exec -T --user git application \
|
||||
gitea admin auth add-ldap \
|
||||
{{ gitea_ldap_auth_args | join(' ') }}
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: ldap_manage
|
||||
failed_when: ldap_manage.rc != 0 and "login source already exists" not in ldap_manage.stderr
|
||||
|
||||
- name: "Lookup existing LDAP auth source ID"
|
||||
shell: |
|
||||
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
||||
exec -T --user git application \
|
||||
gitea admin auth list \
|
||||
| tail -n +2 \
|
||||
| grep -F "LDAP ({{ primary_domain }})" \
|
||||
| awk '{print $1; exit}'
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: ldap_source_id_raw
|
||||
failed_when:
|
||||
- ldap_source_id_raw.rc != 0
|
||||
- ldap_source_id_raw.stdout == ""
|
||||
changed_when: false
|
||||
|
||||
- name: "Set LDAP source ID fact"
|
||||
set_fact:
|
||||
ldap_source_id: "{{ ldap_source_id_raw.stdout }}"
|
||||
|
||||
- name: "Update LDAP Authentication Source"
|
||||
shell: |
|
||||
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
||||
exec -T --user git application \
|
||||
gitea admin auth update-ldap \
|
||||
--id {{ ldap_source_id }} \
|
||||
{{ gitea_ldap_auth_args | join(' ') }}
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: ldap_manage
|
||||
failed_when: ldap_manage.rc != 0
|
52
roles/web-app-gitea/tasks/setup/oidc.yml
Normal file
52
roles/web-app-gitea/tasks/setup/oidc.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
- name: "Add Keycloak OIDC Provider"
|
||||
shell: |
|
||||
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
||||
exec -T --user git application \
|
||||
gitea admin auth add-oauth \
|
||||
--provider openidConnect \
|
||||
--name "{{ oidc.button_text }}" \
|
||||
--key "{{ oidc.client.id }}" \
|
||||
--secret "{{ oidc.client.secret }}" \
|
||||
--auto-discover-url "{{ oidc.client.discovery_document }}" \
|
||||
--scopes "openid profile email"
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: oidc_manage
|
||||
failed_when: oidc_manage.rc != 0 and "login source already exists" not in oidc_manage.stderr
|
||||
|
||||
- name: "Lookup existing Keycloak auth source ID"
|
||||
shell: |
|
||||
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
||||
exec -T --user git application \
|
||||
/app/gitea/gitea admin auth list \
|
||||
| tail -n +2 \
|
||||
| grep -F "{{ oidc.button_text }}" \
|
||||
| awk '{print $1; exit}'
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: oidc_source_id_raw
|
||||
failed_when:
|
||||
- oidc_source_id_raw.rc != 0
|
||||
- oidc_source_id_raw.stdout == ""
|
||||
changed_when: false
|
||||
|
||||
- name: "Set Keycloak source ID fact"
|
||||
set_fact:
|
||||
oidc_source_id: "{{ oidc_source_id_raw.stdout }}"
|
||||
|
||||
- name: "Update Keycloak OIDC Provider"
|
||||
shell: |
|
||||
docker-compose -f "{{ docker_compose.directories.instance }}/docker-compose.yml" \
|
||||
exec -T --user git application \
|
||||
gitea admin auth update-oauth \
|
||||
--id {{ oidc_source_id }}\
|
||||
--provider openidConnect \
|
||||
--name "{{ oidc.button_text }}" \
|
||||
--key "{{ oidc.client.id }}" \
|
||||
--secret "{{ oidc.client.secret }}" \
|
||||
--auto-discover-url "{{ oidc.client.discovery_document }}" \
|
||||
--scopes "openid profile email"
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: oidc_manage
|
||||
failed_when: oidc_manage.rc != 0
|
Reference in New Issue
Block a user