Fix k8s installs using external db

This commit is contained in:
Shane McDonald
2019-11-04 09:35:11 -05:00
parent 0d68ca8f14
commit fa278f83ad

View File

@@ -113,14 +113,15 @@
seconds: "{{ postgress_activate_wait }}" seconds: "{{ postgress_activate_wait }}"
when: openshift_pg_activate.changed or kubernetes_pg_activate.changed when: openshift_pg_activate.changed or kubernetes_pg_activate.changed
- name: Check postgres version and upgrade Postgres if necessary
block:
- name: Check if Postgres 9.6 is being used - name: Check if Postgres 9.6 is being used
shell: | shell: |
POD=$({{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \ POD=$({{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
get pods -l=name=postgresql --field-selector status.phase=Running -o jsonpath="{.items[0].metadata.name}") get pods -l=name=postgresql --field-selector status.phase=Running -o jsonpath="{.items[0].metadata.name}")
{{ kubectl_or_oc }} exec -ti $POD -n {{ kubernetes_namespace }} -- bash -c "psql -U {{ pg_username }} -tAc 'select version()'" oc exec $POD -n {{ kubernetes_namespace }} -- bash -c "psql -tAc 'select version()'"
register: pg_version register: pg_version
- name: Upgrade postgres if necessary
- name: Upgrade Postgres if necessary
block: block:
- name: Set new pg image - name: Set new pg image
shell: | shell: |
@@ -165,6 +166,8 @@
pause: pause:
seconds: "{{ postgress_activate_wait }}" seconds: "{{ postgress_activate_wait }}"
when: "pg_version is success and '9.6' in pg_version.stdout" when: "pg_version is success and '9.6' in pg_version.stdout"
when:
- pg_hostname is not defined or pg_hostname == ''
- name: Set image names if using custom registry - name: Set image names if using custom registry
block: block: