Hi,
I do export the “–job_templates” resource with the following command:
(venv) root@awx-vm01:/srv# awx --conf.host http://172.22.1.30:30080 --conf.username admin --conf.password my_password --conf.insecure export --job_templates “Destroy aws-ec2-sg” > job_templates.json
It seems to be working well:
(venv) root@awx-vm01:/srv# cat job_templates.json
{
“job_templates”: [
{
“name”: “Destroy aws-ec2-sg”,
“description”: “”,
“job_type”: “run”,
“playbook”: “playbooks/aws-ec2-sg-destroy.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,
“execution_environment”: null,
“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,
“ask_execution_environment_on_launch”: false,
“ask_labels_on_launch”: false,
“ask_forks_on_launch”: false,
“ask_job_slice_count_on_launch”: false,
“ask_timeout_on_launch”: false,
“ask_instance_groups_on_launch”: false,
“survey_enabled”: true,
“become_enabled”: false,
“diff_mode”: false,
“allow_simultaneous”: true,
“job_slice_count”: 1,
“webhook_service”: “”,
“webhook_credential”: null,
“prevent_instance_group_fallback”: false,
“inventory”: {
“organization”: {
“name”: “GD Organization”,
“type”: “organization”
},
“name”: “GD Inventory - Static Hosts”,
“type”: “inventory”
},
“project”: {
“organization”: {
“name”: “GD Organization”,
“type”: “organization”
},
“name”: “GitLab Playbooks-Roles”,
“type”: “project”
},
“related”: {
“labels”: ,
“credentials”: ,
“schedules”: ,
“notification_templates_started”: ,
“notification_templates_success”: ,
“notification_templates_error”: ,
“survey_spec”: {
“name”: “”,
“description”: “”,
“spec”: [
{
“question_name”: “Security Group name”,
“question_description”: “”,
“required”: true,
“type”: “text”,
“variable”: “ec2_security_group_name_tag”,
“min”: 3,
“max”: 30,
“default”: “aws-test999-sg”,
“choices”: “”,
“new_question”: true
}
]
}
},
“natural_key”: {
“organization”: {
“name”: “GD Organization”,
“type”: “organization”
},
“name”: “Destroy aws-ec2-sg”,
“type”: “job_template”
}
}
]
}
And I’m trying to import the resource “–job_templates” to another AWX host with the following command:
(venv) root@awx-vm01:/srv# awx --conf.host http://172.22.1.33:30080 --conf.username admin --conf.password my_password --conf.insecure import < job_templates.json
I get an error message:
/api/v2/job_templates/ “Destroy aws-ec2-sg”: Bad Request (400) received - {‘inventory’: [‘Must either set a default value or ask to prompt on launch.’]}.
Although the Inventory is listed in the “job_templates.json” file for the selected Job Template.
My setup is:
AWX 22.1.0
AWX Operator 2.0.1
AWX 22.1.0
AWX Operator 2.0.1
(venv) root@awx-vm01:/srv# pip3 list
Package Version
awxkit 22.1.0
certifi 2022.12.7
charset-normalizer 3.1.0
idna 3.4
pip 20.0.2
pkg-resources 0.0.0
PyYAML 6.0
requests 2.28.2
setuptools 44.0.0
urllib3 1.26.15
(venv) root@awx-vm01:/srv# pip3 show awxkit
Name: awxkit
Version: 22.1.0
Summary: The official command line interface for Ansible AWX
Home-page: https://github.com/ansible/awx
Author: Red Hat, Inc.
Author-email: info@ansible.com
License: Apache 2.0
Location: /srv/venv/lib/python3.8/site-packages
Requires: PyYAML, requests
Required-by:
Just need to figure out how to make it work all together (export/import).
Can anyone with awx cli working share how you put it all together?
Thanks.