diff --git a/awx_collection/plugins/modules/tower_job_template.py b/awx_collection/plugins/modules/tower_job_template.py index 96ab600cf8..3a42a3ade1 100644 --- a/awx_collection/plugins/modules/tower_job_template.py +++ b/awx_collection/plugins/modules/tower_job_template.py @@ -453,7 +453,7 @@ def main(): new_fields['inventory'] = module.resolve_name_to_id('inventories', inventory) if project is not None: if organization_id is not None: - project_data, project = module.get_one('projects', name_or_id=project, **{ + project_data = module.get_one('projects', name_or_id=project, **{ 'data': { 'organization': organization_id, } diff --git a/awx_collection/tools/roles/generate/templates/tower_module.j2 b/awx_collection/tools/roles/generate/templates/tower_module.j2 index 8c82da660d..60e65cf92c 100644 --- a/awx_collection/tools/roles/generate/templates/tower_module.j2 +++ b/awx_collection/tools/roles/generate/templates/tower_module.j2 @@ -175,7 +175,7 @@ def main(): {% endfor %} # Attempt to look up an existing item based on the provided data - existing_item, name = module.get_one('{{ item_type }}', name_or_id={{ name_option }}, **{ + existing_item = module.get_one('{{ item_type }}', name_or_id={{ name_option }}, **{ 'data': { {% if 'organization' in item['json']['actions']['POST'] and item['json']['actions']['POST']['organization']['type'] == 'id' %} 'organization': org_id, @@ -194,7 +194,7 @@ def main(): new_fields = {} {% for option in item['json']['actions']['POST'] %} {% if option == name_option %} - new_fields['{{ name_option }}'] = new_{{ name_option }} if new_{{ name_option }} else {{ name_option }} + new_fields['{{ name_option }}'] = new_{{ name_option }} if new_{{ name_option }} else (module.get_item_name(existing_item) if existing_item else {{ name_option }}t) {% else %} if {{ option }} is not None: {% if item['json']['actions']['POST'][option]['type'] == 'id' %}