Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix creation of users #161

Merged
merged 4 commits into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions tasks/local_git_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
- name: Identify gitea users
ansible.builtin.command: su - {{ gitea_user }} -c '{{ gitea_full_executable_path }} -c {{ gitea_configuration_path }}/gitea.ini admin user list'
become: true
register: _giteusers
register: _giteausers
changed_when: false

- name: Use gitea cli to create user
become: true
ansible.builtin.command: |
su - {{ gitea_user }} -c
'{{ gitea_full_executable_path }} -c {{ gitea_configuration_path }}/gitea.ini
admin user create --username "{{ item.name }}"
--password "{{ item.password }}" --email "{{ item.email }}"
su - {{ gitea_user }} -c \
'{{ gitea_full_executable_path }} -c {{ gitea_configuration_path }}/gitea.ini \
admin user create --username "{{ item.name }}" \
--password "{{ item.password }}" --email "{{ item.email }}" \
--must-change-password={{ item.must_change_password }} --admin={{ item.admin }}'
register: _gitearesult
failed_when:
- '"successfully created" not in gitearesult.stdout'
- '"successfully created" not in _gitearesult.stdout'
changed_when:
- '"successfully created!" in gitearesult.stdout'
when: "_giteusers is defined and item.name in _giteusers"
- '"successfully created!" in _gitearesult.stdout'
when: "_giteausers is defined and item.name not in _giteausers.stdout"
loop: "{{ gitea_users }}"