mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 10:19:09 +00:00 
			
		
		
		
	Added mailu_token_enabled condition
This commit is contained in:
		| @@ -1,24 +1,3 @@ | ||||
| - 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 | ||||
| 
 | ||||
| - 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 }}" | ||||
| 
 | ||||
| - name: "Fetch existing API tokens via curl inside admin container" | ||||
|   command: >- | ||||
							
								
								
									
										25
									
								
								roles/docker-mailu/tasks/create-mailu-user.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								roles/docker-mailu/tasks/create-mailu-user.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| - 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 | ||||
|  | ||||
| - 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 }}" | ||||
|  | ||||
| - name: "Create Mailu API Token for {{ mailu_user_name }}" | ||||
|   include_tasks: create-mailu-token.yml | ||||
|   when: mailu_token_enabled | ||||
| @@ -25,8 +25,8 @@ | ||||
|   meta: flush_handlers | ||||
|   when: run_once_docker_mailu is not defined | ||||
|  | ||||
| - name: "Create Mailu accounts and API tokens" | ||||
|   include_tasks: create-mailu-user-and-token.yml | ||||
| - name: "Create Mailu accounts" | ||||
|   include_tasks: create-mailu-user.yml | ||||
|   vars: | ||||
|     mailu_compose_dir:        "{{ docker_compose.directories.instance }}" | ||||
|     mailu_domain:             "{{ primary_domain }}" | ||||
| @@ -36,6 +36,7 @@ | ||||
|     mailu_user_key:           "{{ item.key }}" | ||||
|     mailu_user_name:          "{{ item.value.username }}" | ||||
|     mailu_password:           "{{ item.value.password }}" | ||||
|     mailu_token_enabled:      "{{ item.value.mailu_token_enabled | default(false)}}" | ||||
|     mailu_token_ip:           "{{ item.value.ip | default('') }}" | ||||
|   loop:                       "{{ users | dict2items }}" | ||||
|   loop_control: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user