Migrate services part
This commit is contained in:
		
							parent
							
								
									7c59e4ae57
								
							
						
					
					
						commit
						73bce8f6e5
					
				
					 157 changed files with 3883 additions and 9 deletions
				
			
		
							
								
								
									
										57
									
								
								roles/caddy/tasks/main.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								roles/caddy/tasks/main.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| --- | ||||
| - name: Set common facts | ||||
|   ansible.builtin.import_tasks: tasks/set-default-facts.yml | ||||
| 
 | ||||
| - name: Deploy {{ svc.name }} | ||||
|   vars: | ||||
|     svc: "{{ caddy_svc }}" | ||||
|     env: "{{ caddy_env }}" | ||||
|     compose: "{{ caddy_compose }}" | ||||
|   block: | ||||
|     - name: Import prepare tasks for common service | ||||
|       ansible.builtin.import_tasks: tasks/prepare-common-service.yml | ||||
| 
 | ||||
|     - name: Copy the Dockerfile | ||||
|       ansible.builtin.copy: | ||||
|         src: Dockerfile | ||||
|         dest: "{{ (service_path, 'Dockerfile') | path_join }}" | ||||
|         mode: "0644" | ||||
|       register: cmd_result | ||||
| 
 | ||||
|     - name: Set the docker rebuild flag | ||||
|       ansible.builtin.set_fact: | ||||
|         docker_rebuild: true | ||||
|       when: cmd_result.changed # noqa: no-handler We need to handle the restart per service. Handlers don't support variables. | ||||
| 
 | ||||
|     - name: Set caddy config path | ||||
|       ansible.builtin.set_fact: | ||||
|         config_path: "{{ (service_path, 'config') | path_join }}" | ||||
| 
 | ||||
|     - name: Create config directory | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ config_path }}" | ||||
|         state: directory | ||||
|         mode: "0755" | ||||
| 
 | ||||
|     - name: Template caddyfile | ||||
|       ansible.builtin.template: | ||||
|         src: Caddyfile.j2 | ||||
|         dest: "{{ (config_path, 'Caddyfile') | path_join }}" | ||||
|         mode: "0644" | ||||
|       notify: Reload caddy | ||||
| 
 | ||||
|     - name: Copy snippets file | ||||
|       ansible.builtin.copy: | ||||
|         src: snippets | ||||
|         dest: "{{ (config_path, 'snippets') | path_join }}" | ||||
|         mode: "0644" | ||||
|       notify: Reload caddy | ||||
| 
 | ||||
|     - name: Create sites-config directory | ||||
|       ansible.builtin.file: | ||||
|         path: "{{ caddy_config_path }}" | ||||
|         state: directory | ||||
|         mode: "0755" | ||||
| 
 | ||||
|     - name: Import start tasks for common service | ||||
|       ansible.builtin.import_tasks: tasks/start-common-service.yml | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue