With a fresh copy of the awx repository, on a brand new K8S cluster, with only helm/tiller installed. The installer fails at the "Check if Postgres 9.6 is being used" step with 2 separate failures. The first is that it cannot find the pod because of the wrong label being used. The second is once the label check issue is resolved it cannot connect to postgresql because it doesn't know the password.
devel (as of 11/3/2019, 5246c842)inventory, setting kubernetes_context, kubernetes_namespace, tiller_namespace, leave everything else defaultansible-playbook -i inventory install.ymllabel=name=postgrtesql, I altered installer/roles/kubernetes/tasks/main.yml to change this to look for label=app=postgresql
{{ kubectl_or_oc }} exec -ti $POD -n {{ kubernetes_namespace }} -- bash -c "psql \"postgresql://{{ pg_username }}:{{ pg_password }}@localhost\" -tAc 'select version()'"
Clean cluster install with no modifications to the Ansible scripts.
Install fails trying to find postgresql and then trying to connect to it once script was altered.
Using the exact same steps above, the install is successful on the 7.0.0 tag.
I was able to fix this by changing the task to:
- name: Check if Postgres 9.6 is being used
shell: |
POD=$({{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
get pods -l=app=postgresql --field-selector status.phase=Running -o jsonpath="{.items[0].metadata.name}")
{{ kubectl_or_oc }} exec -ti $POD -n {{ kubernetes_namespace }} -- bash -c "PGPASSWORD={{ pg_password }} psql -U {{ pg_username }} -tAc 'select version()'"
register: pg_version
@calvinbui Were you able to then have AWX start successfully? I noticed that even after I changed these values, the dashboard was still inaccessible.
No, it will fail due to https://github.com/ansible/awx/pull/5218/files
This check also fails if the postgressql database is external to AWX. That task should have a conditional to check if pg_hostname is defined. I worked around this with a patch like this:
diff --git a/installer/roles/kubernetes/tasks/main.yml b/installer/roles/kubernetes/tasks/main.yml
index 8f03022..6f72b17 100644
--- a/installer/roles/kubernetes/tasks/main.yml
+++ b/installer/roles/kubernetes/tasks/main.yml
@@ -118,6 +118,7 @@
POD=$({{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
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()'"
name: Upgrade Postgres if necessary
@@ -164,7 +165,9 @@
name: Set image names if using custom registry
block:
Will be fixed by https://github.com/ansible/awx/pull/5227
Fix will be included in AWX 9.0.1 which I'm pushing out now.
Removing # from the pg_hostname in Inventory file works for me.
Inventory file shall have following:
pg_hostname=postgresql
Most helpful comment
Will be fixed by https://github.com/ansible/awx/pull/5227