TASK [kubernetes : Migrate database] failing

Hi Team,

I am trying to install AWX using kubernetes with external postgres. But while executing Migrate database task getting below error.

TASK [kubernetes : Migrate database] *************************************************************************************************

fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: “kubectl -n 2304378531 exec ansible-tower-management – bash -c "awx-manage migrate --noinput"”, “delta”: “0:00:05.503190”, “end”: “2019-08-19 13:14:24.285694”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2019-08-19 13:14:18.782504”, “stderr”: “Traceback (most recent call last):\n File "/usr/bin/awx-manage", line 11, in \n load_entry_point(‘awx==4.0.0.0’, ‘console_scripts’, ‘awx-manage’)()\n File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/init.py", line 140, in manage\n execute_from_command_line(sys.argv)\n File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/init.py", line 364, in execute_from_command_line\n utility.execute()\n File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/init.py", line 356, in execute\n self.fetch_command(subcommand).run_from_argv(self.argv)\n File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv\n self.execute(*args, **cmd_options)\n File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in execute\n output = self.handle(*args, **options)\n File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/commands/migrate.py", line 86, in handle\n executor.loader.check_consistent_history(connection)\n File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 298, in check_consistent_history\n connection.alias,\ndjango.db.migrations.exceptions.InconsistentMigrationHistory: Migration oauth2_provider.0001_initial is applied before its dependency main.0025_v330_add_oauth_activity_stream_registrar on database ‘default’.\ncommand terminated with exit code 1”, “stderr_lines”: [“Traceback (most recent call last):”, " File "/usr/bin/awx-manage", line 11, in “, " load_entry_point(‘awx==4.0.0.0’, ‘console_scripts’, ‘awx-manage’)()”, " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/init.py", line 140, in manage", " execute_from_command_line(sys.argv)“, " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/init.py", line 364, in execute_from_command_line”, " utility.execute()“, " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/init.py", line 356, in execute”, " self.fetch_command(subcommand).run_from_argv(self.argv)“, " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv”, " self.execute(*args, **cmd_options)“, " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in execute”, " output = self.handle(*args, **options)“, " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/commands/migrate.py", line 86, in handle”, " executor.loader.check_consistent_history(connection)“, " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/db/migrations/loader.py", line 298, in check_consistent_history”, " connection.alias,", “django.db.migrations.exceptions.InconsistentMigrationHistory: Migration oauth2_provider.0001_initial is applied before its dependency main.0025_v330_add_oauth_activity_stream_registrar on database ‘default’.”, “command terminated with exit code 1”], “stdout”: “”, “stdout_lines”: }

to retry, use: --limit @/Users/ashok.g/Desktop/awx-devel/installer/install.retry

PLAY RECAP ***************************************************************************************************************************

localhost : ok=18 changed=8 unreachable=0 failed=1

Anyone Please help me on this

What changes you had made in the inventory file, can you share that

Hi raja,

please find the attached inventory file.

Thanks,
Ashok.G

(attachments)

inventory.rtf (6.15 KB)

Are you installing onto a fresh database? If so, this message seems like inconsistent behavior from the Django migration dependency resolver. This dependency was added in AWX 1.0.7, I would not be surprised if upgrading from certain versions around that time hit this (but doesn’t sound like this describes your case). Let me just throw this out there as one of the things to try

check your current state:
awx-manage showmigrations

back out the migration which is a dependency of the other:
awx-manage migrate oauth2_provider zero

then move forward again:
awx-manage migrate

You might want to keep some backups around if you try this.

AWX database is created in the external pg server and its up and reachable