mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-02 00:20:35 +02:00
Huge role refactoring/cleanup. Other commits will propably follow. Because some bugs will exist. Still important for longrun and also for auto docs/help/slideshow generation
This commit is contained in:
27
roles/web-app-mailu/tasks/create-mailu-user.yml
Normal file
27
roles/web-app-mailu/tasks/create-mailu-user.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
- name: "Ensure Mailu user '{{ mailu_user_key }};{{ mailu_user_name }}@{{ mailu_domain }}'' exists"
|
||||
command: >
|
||||
docker compose exec admin flask mailu {{ mailu_action }}
|
||||
{{ mailu_user_name }} {{ mailu_domain }} '{{ mailu_password }}'
|
||||
args:
|
||||
chdir: "{{ mailu_compose_dir }}"
|
||||
register: mailu_user_result
|
||||
failed_when: >
|
||||
mailu_user_result.rc != 0 and
|
||||
(
|
||||
"exists, not created" not in mailu_user_result.stderr and
|
||||
"Duplicate entry" not in mailu_user_result.stderr
|
||||
)
|
||||
changed_when: mailu_user_result.rc == 0
|
||||
when: "'mail-bot' in item.value.roles or 'administrator' in item.value.roles"
|
||||
|
||||
- name: "Change password for user '{{ mailu_user_key }};{{ mailu_user_name }}@{{ mailu_domain }}'"
|
||||
command: >
|
||||
docker compose exec admin flask mailu password
|
||||
{{ mailu_user_name }} {{ mailu_domain }} '{{ mailu_password }}'
|
||||
args:
|
||||
chdir: "{{ mailu_compose_dir }}"
|
||||
when: "'mail-bot' in item.value.roles or 'administrator' in item.value.roles"
|
||||
|
||||
- name: "Create Mailu API Token for {{ mailu_user_name }}"
|
||||
include_tasks: create-mailu-token.yml
|
||||
when: "{{ 'mail-bot' in item.value.roles }}"
|
Reference in New Issue
Block a user