diff --git a/awx_collection/plugins/modules/job_template.py b/awx_collection/plugins/modules/job_template.py index 6f09e2a5aa83..d11dfaf96815 100644 --- a/awx_collection/plugins/modules/job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -479,8 +479,11 @@ def main(): search_fields['organization'] = new_fields['organization'] = organization_id ee = module.params.get('execution_environment') - if ee: + if ee is not None: + if ee != '' and ee != 'None' and ee != '{}': new_fields['execution_environment'] = module.resolve_name_to_id('execution_environments', ee) + else: + new_fields['execution_environment'] = None # Attempt to look up an existing item based on the provided data existing_item = module.get_one('job_templates', name_or_id=name, check_exists=(state == 'exists'), **{'data': search_fields})