1
1
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_gitea.git synced 2024-08-16 11:39:50 +02:00

Merge pull request #161 from koenekelschot/patch-1

Fix creation of users
This commit is contained in:
L3D 2024-04-07 18:55:50 +02:00 committed by GitHub
commit f5aaa880be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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