mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 10:19:09 +00:00 
			
		
		
		
	Semi bsr for applications[] to prevent heavy to debug bugs in j2 - part 1
This commit is contained in:
		| @@ -1,14 +1,14 @@ | ||||
| --- | ||||
| - name: "stop and remove discourse container if it exist" | ||||
|   docker_container: | ||||
|     name: "{{applications[application_id].container}}" | ||||
|     name: "{{applications | get_app_conf(application_id, 'container', True)}}" | ||||
|     state: absent | ||||
|   register: container_action | ||||
|   failed_when: container_action.failed and 'No such container' not in container_action.msg | ||||
|   listen: recreate discourse | ||||
|    | ||||
| - name: "add central database temporary to {{application_id}}_default" | ||||
|   command: docker network connect {{applications[application_id].network}} {{ database_host }} | ||||
|   command: docker network connect {{applications | get_app_conf(application_id, 'network', True)}} {{ database_host }} | ||||
|   failed_when: > | ||||
|     result.rc != 0 and | ||||
|     'already exists in network' not in result.stderr | ||||
| @@ -17,7 +17,7 @@ | ||||
|   listen: recreate discourse | ||||
|  | ||||
| - name: rebuild discourse | ||||
|   shell: ./launcher rebuild {{applications[application_id].container}} | ||||
|   shell: ./launcher rebuild {{applications | get_app_conf(application_id, 'container', True)}} | ||||
|   args: | ||||
|     executable: /bin/bash   | ||||
|     chdir: "{{docker_repository_directory }}" | ||||
|   | ||||
| @@ -43,26 +43,26 @@ | ||||
|   meta: flush_handlers | ||||
|   when: run_once_docker_discourse is not defined | ||||
|  | ||||
| - name: "Connect {{ applications[application_id].container }} to network {{ applications['svc-db-postgres'].network }}" | ||||
| - name: "Connect {{ applications | get_app_conf(application_id, 'container', True) }} to network {{ applications['svc-db-postgres'].network }}" | ||||
|   command: > | ||||
|     docker network connect {{ applications['svc-db-postgres'].network }} {{ applications[application_id].container }} | ||||
|     docker network connect {{ applications['svc-db-postgres'].network }} {{ applications | get_app_conf(application_id, 'container', True) }} | ||||
|   register: network_connect | ||||
|   failed_when: > | ||||
|     network_connect.rc != 0 and | ||||
|     'Error response from daemon: endpoint with name {{ applications[application_id].container }} already exists in network {{ applications["svc-db-postgres"].network }}' | ||||
|     'Error response from daemon: endpoint with name {{ applications | get_app_conf(application_id, 'container', True) }} already exists in network {{ applications["svc-db-postgres"].network }}' | ||||
|     not in network_connect.stderr | ||||
|   changed_when: network_connect.rc == 0 | ||||
|   when: | ||||
|     - applications | is_feature_enabled('central_database', application_id) | ||||
|     - run_once_docker_discourse is not defined | ||||
|  | ||||
| - name: "Remove {{ applications[application_id].network }} from {{ database_host }}" | ||||
| - name: "Remove {{ applications | get_app_conf(application_id, 'network', True) }} from {{ database_host }}" | ||||
|   command: > | ||||
|     docker network disconnect {{ applications[application_id].network }} {{ database_host }} | ||||
|     docker network disconnect {{ applications | get_app_conf(application_id, 'network', True) }} {{ database_host }} | ||||
|   register: network_disconnect | ||||
|   failed_when: > | ||||
|     network_disconnect.rc != 0 and | ||||
|     'is not connected to network {{ applications[application_id].network }}' not in network_disconnect.stderr | ||||
|     'is not connected to network {{ applications | get_app_conf(application_id, 'network', True) }}' not in network_disconnect.stderr | ||||
|   changed_when: network_disconnect.rc == 0 | ||||
|   when: | ||||
|     - applications | is_feature_enabled('central_database', application_id) | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  | ||||
| - name: "cleanup central database from {{application_id}}_default network" | ||||
|   command: | ||||
|     cmd: "docker network disconnect {{applications[application_id].network}} {{ database_host }}" | ||||
|     cmd: "docker network disconnect {{applications | get_app_conf(application_id, 'network', True)}} {{ database_host }}" | ||||
|   ignore_errors: true | ||||
|  | ||||
| - name: "destroy container discourse_application" | ||||
|   | ||||
| @@ -178,4 +178,4 @@ run: | ||||
|  | ||||
| docker_args: | ||||
|   - --network={{application_id}}_default | ||||
|   - --name={{applications[application_id].container}} | ||||
|   - --name={{applications | get_app_conf(application_id, 'container', True)}} | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| application_id:                         "discourse" | ||||
| database_password:                      "{{ applications[application_id].credentials.database_password }}" | ||||
| database_password:                      "{{ applications | get_app_conf(application_id, 'credentials.database_password', True) }}" | ||||
| database_type:                          "postgres" | ||||
| docker_repository_directory :           "{{docker_compose.directories.services}}{{applications[application_id].repository}}/" | ||||
| discourse_application_yml_destination:  "{{docker_repository_directory }}containers/{{applications[application_id].container}}.yml" | ||||
| docker_repository_directory :           "{{docker_compose.directories.services}}{{applications | get_app_conf(application_id, 'repository', True)}}/" | ||||
| discourse_application_yml_destination:  "{{docker_repository_directory }}containers/{{applications | get_app_conf(application_id, 'container', True)}}.yml" | ||||
| docker_compose_flush_handlers:          false | ||||
		Reference in New Issue
	
	Block a user