From 71b75fd89bf0465a8dfc338a6b07fb68a95a4181 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 3 Sep 2024 21:13:50 +0200 Subject: [PATCH] hide gitea passwort from ansible default output CLOSE https://github.com/roles-ansible/ansible_role_gitea/issues/170 --- tasks/local_git_users.yml | 20 +++++++++++++------- vars/main.yml | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tasks/local_git_users.yml b/tasks/local_git_users.yml index 6c1e658..9fb1597 100644 --- a/tasks/local_git_users.yml +++ b/tasks/local_git_users.yml @@ -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 diff --git a/vars/main.yml b/vars/main.yml index 07c9420..ffb5179 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -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'