Skip to content

Commit

Permalink
Merge pull request #171 from roles-ansible/pwd
Browse files Browse the repository at this point in the history
hide gitea passwort from ansible default output
  • Loading branch information
DO1JLR authored Sep 3, 2024
2 parents 49224c8 + 71b75fd commit 9a235c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions tasks/local_git_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,33 @@
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 }}" \
--must-change-password={{ item.must_change_password }} --admin={{ item.admin }}'
admin user create --username "{{ user.name }}" \
--password "{{ user.password }}" --email "{{ user.email }}" \
--must-change-password={{ user.must_change_password }} --admin={{ user.admin }}'
register: _gitearesult
failed_when:
- '"successfully created" not in _gitearesult.stdout'
changed_when:
- '"successfully created!" in _gitearesult.stdout'
when: "_giteausers is defined and item.name not in _giteausers.stdout and item.state | default('present') == 'present'"
when: "_giteausers is defined and user.name not in _giteausers.stdout and user.state | default('present') == 'present'"
loop: "{{ gitea_users }}"
loop_control:
label: "user={{ user.name }}"
loop_var: user

- name: Use gitea cli to delete user
become: true
ansible.builtin.command: |
su - {{ gitea_user }} -c \
'{{ gitea_full_executable_path }} -c {{ gitea_configuration_path }}/gitea.ini \
admin user delete --username "{{ item.name }}"'
admin user delete --username "{{ user.name }}"'
register: _giteadelresult
failed_when:
- '"error" in _giteadelresult.stdout'
changed_when:
"_giteausers is defined and item.name in _giteausers.stdout"
when: "_giteausers is defined and item.name in _giteausers.stdout and item.state | default('present') == 'absent'"
"_giteausers is defined and user.name in _giteausers.stdout"
when: "_giteausers is defined and user.name in _giteausers.stdout and user.state | default('present') == 'absent'"
loop: "{{ gitea_users }}"
loop_control:
label: "user={{ user.name }}"
loop_var: user
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ transfer_custom_footer:
- 'files/gitea_footer/extra_links_footer.tmpl'
- 'files/extra_links_footer.tmpl'

playbook_version_number: 60
playbook_version_number: 61
playbook_version_path: 'do1jlr.gitea.version'

0 comments on commit 9a235c6

Please sign in to comment.