How to Repair Ansible Tower Upgrade Failing on PostgreSQL Credentials

Solution In Progress - Updated -

Issue

During an upgrade of Ansible Tower, you receive error:

TASK [restore : Perform a PostgreSQL restore (external).] ************************************************************************************
skipping: [<your db host>] => {"changed": false, "skip_reason": "Conditional result was False"}
skipping: [<your db host>] => {"changed": false, "skip_reason": "Conditional result was False"}
fatal: [<your db host>]: FAILED! => {"changed": true, "cmd": "psql --host='<pg_host>' --port=<pg_port> --username='<pg_username>' --dbname='template1' < ./tower.db && psql --host='<pg_host>' --port=<pg_port> --username='<pg_username>' --dbname='<pg_database>' < ./new_instance_topology.db", "delta": "<timestamp>", "end": "<timestamp>", "msg": "non-zero return code", "rc": 2, "start": "<timestamp>", "stderr": "ERROR:  permission denied to create database\nERROR: database \"<pg_database>\" does not exist\n\\connect: FATAL:  database \"<pg_database>\" does not exist", "stderr_lines": ["ERROR:  permission denied to create database", "ERROR:  database \"<pg_database>\" does not exist", "\\connect: FATAL:  database \"<pg_database>\" does not exist"], "stdout": "SET\nSET\nSET\nSET\nSET\nSET\nSET\nSET\nDROP DATABASE", "stdout_lines": ["SET", "SET", "SET", "SET", "SET", "SET", "SET", "SET", "DROP DATABASE"]}

The values for pg_host, pg_port, pg_username, pg_database are the ones specified in the inventory file next to the setup.sh script. During upgrade, not all of them are required to be in inventory file and therefore values from /etc/tower/conf.d/postgres.py are used as well (e.g. for the password).

Environment

  • Ansible Tower >= 3.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content