2024-04-04 09:48:09 +02:00
|
|
|
---
|
|
|
|
# die Variablen kommen aus
|
|
|
|
# - https://docs.gitea.com/administration/command-line
|
|
|
|
# - https://github.com/lldap/lldap/blob/main/example_configs/gitea.md
|
|
|
|
# und
|
|
|
|
# den jeweiligen group/host-Vars!
|
2024-05-13 12:00:02 +02:00
|
|
|
|
|
|
|
- name: Check if Admin-User exists
|
2024-04-04 09:48:09 +02:00
|
|
|
no_log: true
|
|
|
|
become_user: gitea
|
|
|
|
become: true
|
2024-05-13 12:00:02 +02:00
|
|
|
ansible.builtin.command: |
|
|
|
|
forgejo admin user list \
|
|
|
|
--config "{{ gitea_configuration_path }}/gitea.ini"
|
|
|
|
register: check
|
|
|
|
changed_when: false
|
|
|
|
|
2024-05-25 20:36:46 +02:00
|
|
|
- name: Ensure Admin-User exists # noqa no-changed-when no-jinja-when
|
2024-11-10 15:33:48 +01:00
|
|
|
no_log: true
|
2024-05-13 12:00:02 +02:00
|
|
|
become_user: gitea
|
|
|
|
become: true
|
2024-04-04 09:48:09 +02:00
|
|
|
ansible.builtin.command: |
|
|
|
|
forgejo admin user create \
|
2024-05-13 12:00:02 +02:00
|
|
|
--config "{{ gitea_configuration_path }}/gitea.ini" \
|
2024-04-04 09:48:09 +02:00
|
|
|
--username "{{ gitea_admin_user }}" \
|
|
|
|
--password "{{ gitea_admin_user_pass }}" \
|
|
|
|
--email "{{ gitea_admin_user }}@mgrote.net" \
|
|
|
|
--admin
|
2024-05-13 12:00:02 +02:00
|
|
|
when: 'not "{{ gitea_admin_user }}@mgrote.net" in check.stdout'
|
|
|
|
|
|
|
|
- name: Show existing users
|
|
|
|
ansible.builtin.debug:
|
|
|
|
msg: "{{ check.stdout_lines }}"
|
2024-04-04 09:48:09 +02:00
|
|
|
...
|