From 9d30434b6cbb83892d696a2adbb6ae751c551974 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Fri, 25 May 2018 14:10:33 -0400 Subject: [PATCH] ec2_ami_facts: return images in a consistent order (#40679) * ec2_ami_facts: return images in a consistent order --- lib/ansible/modules/cloud/amazon/ec2_ami_facts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami_facts.py b/lib/ansible/modules/cloud/amazon/ec2_ami_facts.py index 296a893aa16..fe8b57e7640 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami_facts.py @@ -234,6 +234,7 @@ def list_ec2_images(ec2_client, module): # describing launch permissions of images owned by others is not permitted, but shouldn't cause failures pass + images.sort(key=lambda e: e.get('creation_date', '')) # it may be possible that creation_date does not always exist module.exit_json(images=images)