After exporting artifacts from an existing AWX instance and importing into a new instance, job templates don't have any credentials associated with them.
The above is for the new instance. The old instance is AWX 7.0.0 with Ansible 2.8.4, all other environment items are the same for the old instance.
awx command to login and export artifacts from an existing AWX instance. I use a playbook to do this and my task looks like this:- name: SHELL | export artifacts from {{ ap_awx_export_from }}
shell: awx export -k --{{ item }} > awx_{{ ap_awx_export_from | urlsplit('hostname') }}_{{ item }}.json
args:
executable: /bin/bash
creates: awx_{{ ap_awx_export_from | urlsplit('hostname') }}_{{ item }}.json
environment:
TOWER_HOST: "{{ ap_awx_export_from }}"
TOWER_USERNAME: "{{ ap_awx_export_from_username }}"
TOWER_PASSWORD: "{{ ap_awx_export_from_password }}"
TOWER_OAUTH_TOKEN: "{{ ap_awx_export_token }}"
tags: [ artifacts, export ]
loop:
- organizations
- users
- teams
- credential_types
- credentials
- notification_templates
- projects
- inventory
- inventory_sources
- job_templates
- workflow_job_templates
This command is executed on the new instance and, as shown, results in several *.json files corresponding to each AWX artifact type.
I have a subsequent task that performs the import into the new instance, but only imports the following artifacts: organizations, users, teams, credential_types, and credentials
I have another task which fixes the imported credentials by assigning actual values for each credential (e.g. SSH keys, passwords, vault passwords) since the import of credentials brings these things in empty.
I import additional artifacts in the following order: notification_templates, projects
I get a list of imported projects and perform an awx projects update
Finally, I import the remaining artifacts in the following order: inventory, inventory_sources, job_templates, workflow_job_templates
I expect that a given job template on the import system have the credentials field populated with the same set of credentials that were in the job template from the export system.
The job templates import, but the credentials field is empty.
Exported job template credentials:

Imported job template credentials:

@watsonb I was unable to replicate this problem with a simplified set of objects, even when doing separate export and import steps for credentials and job templates. Can you pin this down a bit more?

The credential json:
{
"credentials": [
{
"name": "Demo Credential 2",
"description": "",
"organization": null,
"inputs": {
"username": "admin"
},
"credential_type": {
"name": "Machine",
"kind": "ssh",
"type": "credential_type"
},
"user": {
"username": "admin",
"type": "user"
},
"natural_key": {
"organization": null,
"name": "Demo Credential 2",
"credential_type": {
"name": "Machine",
"kind": "ssh",
"type": "credential_type"
},
"type": "credential"
}
}
]
}
The job template json:
{
"job_templates": [
{
"name": "Demo Job Template 3",
"description": "",
"job_type": "run",
"playbook": "hello_world.yml",
"scm_branch": "",
"forks": 0,
"limit": "",
"verbosity": 0,
"extra_vars": "",
"job_tags": "",
"force_handlers": false,
"skip_tags": "",
"start_at_task": "",
"timeout": 0,
"use_fact_cache": false,
"host_config_key": "",
"ask_scm_branch_on_launch": false,
"ask_diff_mode_on_launch": false,
"ask_variables_on_launch": false,
"ask_limit_on_launch": false,
"ask_tags_on_launch": false,
"ask_skip_tags_on_launch": false,
"ask_job_type_on_launch": false,
"ask_verbosity_on_launch": false,
"ask_inventory_on_launch": false,
"ask_credential_on_launch": false,
"survey_enabled": false,
"become_enabled": false,
"diff_mode": false,
"allow_simultaneous": false,
"custom_virtualenv": null,
"job_slice_count": 1,
"webhook_service": "",
"webhook_credential": null,
"inventory": {
"organization": {
"name": "Default",
"type": "organization"
},
"name": "Demo Inventory",
"type": "inventory"
},
"project": {
"organization": {
"name": "Default",
"type": "organization"
},
"name": "Demo Project",
"type": "project"
},
"related": {
"labels": [],
"credentials": [
{
"organization": null,
"name": "Demo Credential 2",
"credential_type": {
"name": "Machine",
"kind": "ssh",
"type": "credential_type"
},
"type": "credential"
}
],
"schedules": [],
"notification_templates_started": [],
"notification_templates_success": [],
"notification_templates_error": [],
"survey_spec": {}
},
"natural_key": {
"organization": {
"name": "Default",
"type": "organization"
},
"name": "Demo Job Template 3",
"type": "job_template"
}
}
]
}
I'll try to run this again and either simplify it or capture exported credentials, redact them, and review.
@jbradberry I provisioned a fresh AWX 15.0.0 installation and the export/import worked this time (using awxkit==15.0.0) with respect to this issue. I consider it closed.