diff --git a/tasks/local_git_users.yml b/tasks/local_git_users.yml index c2a3c1d..a8d9109 100644 --- a/tasks/local_git_users.yml +++ b/tasks/local_git_users.yml @@ -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 }}"