ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.93k stars 3.41k forks source link

if awx_server != localhost in local_docker role, db upgrade fails ( not adjusted for non_local ) #6813

Open i4o opened 4 years ago

i4o commented 4 years ago
ISSUE TYPE
SUMMARY

Installer suggest to update awx_server from localhost to remote server, if you want to install to remote server. This is how I installed previous ( 7 ) version of AWX. Now when Upgrading to 10+ it wants to upgrade postgres db.

Problem is, file lookup and db upgrade tasks are looking for local files, even if you change inventory to be non-local.

ENVIRONMENT
STEPS TO REPRODUCE

Change awx_server to external server, not localhost

EXPECTED RESULTS

It will fail in lookup for old postgres version ( searching locally, not remotely ). And continue to fail if you just manually set variable:

- name: Determine whether to upgrade postgres
  set_fact:
    upgrade_postgres: yes

because it's still working on local directories during db migration, not remote directories.

i4o commented 4 years ago
- name: Copy old pg_hba.conf
  copy:
    src: "{{ postgres_data_dir + '/pgdata/pg_hba.conf' }}"
    dest: "{{ postgres_data_dir + '/10/data/' }}"
    remote_src: yes <<< needed if not localhost
  when: upgrade_postgres | bool
i4o commented 4 years ago
TASK [local_docker : Upgrade Postgres] ************************************************************************************************************************************************************************************************
fatal: [awx-server]: FAILED! => {"changed": true, "cmd": "docker run --rm  -v /srv/awx/pgdocker/pgdata:/var/lib/postgresql/9.6/data  -v /srv/awx/pgdocker/10/data:/var/lib/postgresql/10/data  -e PGUSER=awx -e POSTGRES_INITDB_ARGS=\"-U awx\"  tianon/postgres-upgrade:9.6-to-10 --username=awx\n", "delta": "0:00:05.052626", "end": "2020-04-23 07:14:41.129798", "msg": "non-zero return code", "rc": 1, "start": "2020-04-23 07:14:36.077172", "stderr": "", "stderr_lines": [], "stdout": "Performing Consistency Checks\n-----------------------------\nChecking cluster versions                                   ok\nChecking database user is the install user                  ok\nChecking database connection settings                       ok\nChecking for prepared transactions                          ok\nChecking for reg* data types in user tables                 ok\nChecking for contrib/isn with bigint-passing mismatch       ok\nChecking for invalid \"unknown\" user columns                 ok\nCreating dump of global objects                             ok\nCreating dump of database schemas\n  awx\n  postgres\n  template1\n                                                            ok\n\nNew cluster database \"awx\" is not empty\nFailure, exiting", "stdout_lines": ["Performing Consistency Checks", "-----------------------------", "Checking cluster versions                                   ok", "Checking database user is the install user                  ok", "Checking database connection settings                       ok", "Checking for prepared transactions                          ok", "Checking for reg* data types in user tables                 ok", "Checking for contrib/isn with bigint-passing mismatch       ok", "Checking for invalid \"unknown\" user columns                 ok", "Creating dump of global objects                             ok", "Creating dump of database schemas", "  awx", "  postgres", "  template1", "