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
14.05k stars 3.42k forks source link

awx-cli Unable to migrate from AWX 17.0.1 (docker) to AWX 19.2.0 (K8S) #10448

Open craph opened 3 years ago

craph commented 3 years ago
ISSUE TYPE
SUMMARY
ENVIRONMENT
STEPS TO REPRODUCE

I'm trying to migrate my AWX 17.1.0 (docker) to the latest version AWX 19.2.0 hosted in k8s and installed with AWX operator. The basic installation works great but I'm unable to migrate the data.

I have tried to follow : https://github.com/ansible/awx/blob/devel/tools/docker-compose/docs/data_migration.md but the process describe here only creates a new postgres container with the data.... but there are no explanations about how to import all the content in kubernetes installation...

Moreover, I have tried to use awxcli to run export and import but I have issue too. The awx export command run well but the import fails...

EXPECTED RESULTS

How to migrate from AWX 17.1.0 (docker) to AWX 19.2.0 (k8s) ? How to export / import data ?

ACTUAL RESULTS

Here is the output of the import commands :

# awx import < /tmp/awx_export 
Object import failed: Bad Request (400) received - {'local_path': ['Cannot change local_path for git-based projects']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Role assignment failed: Bad Request (400) received - {'msg': "You cannot grant credential access to a user not in the credentials' organization"}.
Role assignment failed: Bad Request (400) received - {'msg': "You cannot grant credential access to a user not in the credentials' organization"}.
Role assignment failed: Bad Request (400) received - {'msg': "You cannot grant credential access to a user not in the credentials' organization"}.
Role assignment failed: Bad Request (400) received - {'msg': "You cannot grant credential access to a user not in the credentials' organization"}.
ADDITIONAL INFORMATION
stefanpinter commented 3 years ago

many had troubles with this migration too: https://github.com/ansible/awx/issues/9540

this AWX installation (or migration) stuff is getting really complicated... now i need kubernetes, docker, awx-operator (installation is in an endless loop here right now), serveral ways to install, several ways to migrate (none work or they are overcomplicated), is this really necessary?! what is a local and what is a development installation?

craph commented 3 years ago

Any idea why I have :

Object import failed: Bad Request (400) received - {'local_path': ['Cannot change local_path for git-based projects']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.
Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']}.

Why playbook not found for project ?

Zappelphilipp commented 3 years ago

not the exact same error but maybe related: export works perfectly fine from AWX 7.0 but import into AWX 19.1 fails:

$ awx --conf.host https://NEW_AWX_INSTANCE --conf.insecure --conf.username user --conf.password pass import < projects.json
This endpoint raised an error: /api/v2/credential_types/
This endpoint raised an error: /api/v2/credential_types/
This endpoint raised an error: /api/v2/organizations/
This endpoint raised an error: /api/v2/organizations/
This endpoint raised an error: /api/v2/users/
This endpoint raised an error: /api/v2/users/
This endpoint raised an error: /api/v2/teams/
This endpoint raised an error: /api/v2/teams/
This endpoint raised an error: /api/v2/inventories/
This endpoint raised an error: /api/v2/inventories/
This endpoint raised an error: /api/v2/notification_templates/
This endpoint raised an error: /api/v2/notification_templates/
This endpoint raised an error: /api/v2/workflow_job_templates/
This endpoint raised an error: /api/v2/workflow_job_templates/
This endpoint raised an error: /api/v2/credentials/
This endpoint raised an error: /api/v2/credentials/
This endpoint raised an error: /api/v2/projects/
This endpoint raised an error: /api/v2/projects/
argument of type 'NoneType' is not iterable

--verbose shows:

...
ERROR:awxkit.api.pages.page:This endpoint raised an error: /api/v2/projects/
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/awxkit/cli/__init__.py", line 25, in run
    cli.parse_resource()
  File "/usr/lib/python3.6/site-packages/awxkit/cli/client.py", line 154, in parse_resource
    self.resource = parse_resource(self, skip_deprecated=skip_deprecated)
  File "/usr/lib/python3.6/site-packages/awxkit/cli/resource.py", line 219, in parse_resource
    response = command.handle(client, parser)
  File "/usr/lib/python3.6/site-packages/awxkit/cli/resource.py", line 148, in handle
    client.v2.import_assets(data)
  File "/usr/lib/python3.6/site-packages/awxkit/api/pages/api.py", line 345, in import_assets
    imported = self._import_list(endpoint, data.get(resource) or [])
  File "/usr/lib/python3.6/site-packages/awxkit/api/pages/api.py", line 231, in _import_list
    if field not in post_fields:
TypeError: argument of type 'NoneType' is not iterable

does somebody has a hint regarding this error?

john-westcott-iv commented 2 years ago

For the error: Role assignment failed: Bad Request (400) received - {'msg': "You cannot grant credential access to a user not in the credentials' organization"}. This is fixed by https://github.com/ansible/awx/pull/11845.

For the job template errors: Object import failed: Bad Request (400) received - {'playbook': ['Playbook not found for project.']} Is this job template based on an SCM project? If so, does the project properly sync?