Why Is Ansible Tower Restore Failing At The Task `Tower | Perform a PostgreSQL restore (external)`?

Solution Verified - Updated -

Issue

When performing a restore from a backup, this permission denied to create database error occurred. The awx database was removed after this error, hence this causes the critical issue that the Tower will never be available.

TASK [Tower | Perform a PostgreSQL restore (external).] ***********************************************************************************************************************
fatal: [192.168.0.XXX]: FAILED! => {"changed": true, "cmd": "scl enable rh-postgresql10 -- psql  --host='192.168.0.YYY'  --port=5432  --username='awx'  --dbname='template1' < ./tower.db &&\nscl enable rh-postgresql10 -- psql  --host='192.168.0.YYY'  --port=5432  --username='awx'  --dbname='awx' < ./new_instance_topology.db\n", "delta": "0:00:00.163679", "end": "2021-12-09 17:18:21.272433", "msg": "non-zero return code", "rc": 2, "start": "2021-12-09 17:18:21.108754", "stderr": "ERROR:  permission denied to create database\nERROR:  database \"awx\" does not exist\n\\connect: FATAL:  database \"awx\" does not exist", "stderr_lines": ["ERROR:  permission denied to create database", "ERROR:  database \"awx\" does not exist", "\\connect: FATAL:  database \"awx\" does not exist"], "stdout": "SET\nSET\nSET\nSET\nSET\n set_config \n------------\n \n(1  row)\n\nSET\nSET\nSET\nSET\nDROP DATABASE", "stdout_lines": ["SET", "SET", "SET", "SET", "SET", " set_config ", "------------", " ", "(1 行)", "", "SET", "SET", "SET", "SET", "DROP DATABASE"]}

Environment

Ansible Tower 3.8 with external database

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