Skip to content

Commit

Permalink
creating an admin user fails if we already have one. enforce a known …
Browse files Browse the repository at this point in the history
…password.
  • Loading branch information
Toni Mueller committed Jul 26, 2020
1 parent ede6e4c commit 5c69f97
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,17 @@
command: "{{ gitea_install_path }}/{{ gitea_binary }} admin create-user --username {{ gitea_admin_username }} --password {{ gitea_admin_password | quote }} --email {{ gitea_admin_email }} --admin" # noqa 204 301
become: true
become_user: "{{ gitea_user }}"
register: admin_user_result
ignore_errors: yes
tags: service

- name: change the password for an existing admin user if there was an error
command: "{{ gitea_install_path }}/{{ gitea_binary }} admin change-password -u {{ gitea_admin_username }} -p {{ gitea_admin_password | quote }}" # noqa 204 301
become: true
become_user: "{{ gitea_user }}"
when: admin_user_result.rc != 0
tags: service

- name: enable the service
become: yes
service:
Expand Down

0 comments on commit 5c69f97

Please sign in to comment.