homeserver/roles/mgrote_gitea_setup/tasks/admin.yml
Michael Grote 9114f22e84
Some checks failed
ci/woodpecker/push/gitleaks Pipeline was successful
ci/woodpecker/pr/gitleaks Pipeline was successful
ci/woodpecker/push/ansible-lint Pipeline failed
ci/woodpecker/pr/ansible-lint Pipeline failed
ci/woodpecker/pull_request_closed/gitleaks Pipeline was successful
ci/woodpecker/pull_request_closed/ansible-lint Pipeline was successful
ff
2024-05-13 11:59:25 +02:00

34 lines
966 B
YAML

---
# 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!
- name: Check if Admin-User exists
no_log: true
become_user: gitea
become: true
ansible.builtin.command: |
forgejo admin user list \
--config "{{ gitea_configuration_path }}/gitea.ini"
register: check
changed_when: false
- name: Ensure Admin-User exists
#no_log: true
become_user: gitea
become: true
ansible.builtin.command: |
forgejo admin user create \
--config "{{ gitea_configuration_path }}/gitea.ini" \
--username "{{ gitea_admin_user }}" \
--password "{{ gitea_admin_user_pass }}" \
--email "{{ gitea_admin_user }}@mgrote.net" \
--admin
when: 'not "{{ gitea_admin_user }}@mgrote.net" in check.stdout'
- name: Show existing users
ansible.builtin.debug:
msg: "{{ check.stdout_lines }}"
...