mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-18 06:24:25 +02:00
Removed ignore errors from db management in discourse
This commit is contained in:
parent
41d023abee
commit
707cc9d2d1
@ -1,4 +1,5 @@
|
|||||||
hostname: "central-postgres"
|
hostname: "central-postgres"
|
||||||
|
network: "central_postgres"
|
||||||
port: 5432
|
port: 5432
|
||||||
docker:
|
docker:
|
||||||
images:
|
images:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
- name: Create Docker network for PostgreSQL
|
- name: Create Docker network for PostgreSQL
|
||||||
docker_network:
|
docker_network:
|
||||||
name: central_postgres
|
name: "{{ applications[application_id].network }}"
|
||||||
state: present
|
state: present
|
||||||
ipam_config:
|
ipam_config:
|
||||||
- subnet: "{{ networks.local.postgres.subnet }}"
|
- subnet: "{{ networks.local.postgres.subnet }}"
|
||||||
@ -15,7 +15,7 @@
|
|||||||
POSTGRES_PASSWORD: "{{ applications[application_id].credentials.postgres_password }}"
|
POSTGRES_PASSWORD: "{{ applications[application_id].credentials.postgres_password }}"
|
||||||
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C" # Necessary for web-app-matrix
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C" # Necessary for web-app-matrix
|
||||||
networks:
|
networks:
|
||||||
- name: central_postgres
|
- name: "{{ applications[application_id].network }}"
|
||||||
published_ports:
|
published_ports:
|
||||||
- "127.0.0.1:{{ applications[application_id].port }}:5432"
|
- "127.0.0.1:{{ applications[application_id].port }}:5432"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -1 +1 @@
|
|||||||
application_id: postgres
|
application_id: postgres
|
@ -133,7 +133,7 @@ def update_discourse(directory):
|
|||||||
update_procedure("docker stop {{applications.discourse.container}}")
|
update_procedure("docker stop {{applications.discourse.container}}")
|
||||||
update_procedure("docker rm {{applications.discourse.container}}")
|
update_procedure("docker rm {{applications.discourse.container}}")
|
||||||
try:
|
try:
|
||||||
update_procedure("docker network connect {{applications.discourse.network}} central-postgres")
|
update_procedure("docker network connect {{applications.discourse.network}} {{ applications.postgres.hostname }}")
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
error_message = e.output.decode()
|
error_message = e.output.decode()
|
||||||
if "already exists" in error_message or "is already connected" in error_message:
|
if "already exists" in error_message or "is already connected" in error_message:
|
||||||
|
@ -43,20 +43,29 @@
|
|||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
when: run_once_docker_discourse is not defined
|
when: run_once_docker_discourse is not defined
|
||||||
|
|
||||||
- name: "add {{applications[application_id].container}} to network central_postgres"
|
- name: "Connect {{ applications[application_id].container }} to network {{ applications.postgres.network }}"
|
||||||
command:
|
command: >
|
||||||
cmd: "docker network connect central_postgres {{applications[application_id].container}}"
|
docker network connect {{ applications.postgres.network }} {{ applications[application_id].container }}
|
||||||
ignore_errors: 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.postgres.network }}'
|
||||||
|
not in network_connect.stderr
|
||||||
|
changed_when: network_connect.rc == 0
|
||||||
when:
|
when:
|
||||||
- applications | is_feature_enabled('central_database',application_id)
|
- applications | is_feature_enabled('central_database', application_id)
|
||||||
- run_once_docker_discourse is not defined
|
- run_once_docker_discourse is not defined
|
||||||
|
|
||||||
- name: "remove central database from {{application_id}}_default"
|
- name: "Remove {{ applications[application_id].network }} from {{ database_host }}"
|
||||||
command:
|
command: >
|
||||||
cmd: "docker network disconnect {{applications[application_id].network}} {{ database_host }}"
|
docker network disconnect {{ applications[application_id].network }} {{ database_host }}
|
||||||
ignore_errors: true
|
register: network_disconnect
|
||||||
|
failed_when: >
|
||||||
|
network_disconnect.rc != 0 and
|
||||||
|
'is not connected to network {{ applications[application_id].network }}' not in network_disconnect.stderr
|
||||||
|
changed_when: network_disconnect.rc == 0
|
||||||
when:
|
when:
|
||||||
- applications | is_feature_enabled('central_database',application_id)
|
- applications | is_feature_enabled('central_database', application_id)
|
||||||
- run_once_docker_discourse is not defined
|
- run_once_docker_discourse is not defined
|
||||||
|
|
||||||
- name: run the docker_discourse tasks once
|
- name: run the docker_discourse tasks once
|
||||||
|
@ -9,7 +9,6 @@ features:
|
|||||||
portfolio_iframe: true
|
portfolio_iframe: true
|
||||||
central_database: true
|
central_database: true
|
||||||
oauth2: true
|
oauth2: true
|
||||||
hostname: central-mariadb
|
|
||||||
csp:
|
csp:
|
||||||
flags:
|
flags:
|
||||||
style-src:
|
style-src:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user