From 610fd8ce5663ddb5c9ae61e50d7700f96524fbdd Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Thu, 29 Aug 2024 16:04:58 -0400 Subject: [PATCH] Make the ami pattern generic to avoid searching for deprecated amis (#2268) SUMMARY This fixes the failure seen in https://d04ed4904ec3d4928496-5828abdaefb23a8975ffbcdc8ff7f222.ssl.cf1.rackcdn.com/2227/82e7cd3fcc15efebea7c6fbbcb447e99449af9d3/check/integration-amazon.aws-1/baa1dcd/job-output.txt TASK [Set image id, vpc cidr and subnet cidr] ********************************** 2024-08-23 20:07:43.220507 | controller | task path: /home/zuul-worker/.ansible/collections/ansible_collections/amazon/aws/tests/integration/targets/inventory_aws_ec2/playbooks/tasks/setup.yml:13 2024-08-23 20:07:43.220523 | controller | fatal: [127.0.0.1]: FAILED! => { 2024-08-23 20:07:43.222302 | controller | "msg": "The task includes an option with an undefined variable. The error was: list object has no element 0\n\nThe error appears to be in '/home/zuul-worker/.ansible/collections/ansible_collections/amazon/aws/tests/integration/targets/inventory_aws_ec2/playbooks/tasks/setup.yml': line 13, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set image id, vpc cidr and subnet cidr\n ^ here\n" 2024-08-23 20:07:43.222349 | controller | } AMIs can be deprecated to indicate they are outdated or no longer actively maintained. Fedora-Cloud-Base-37-1.2.x86_64* ami is not available. ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell Reviewed-by: Alina Buzachis --- changelogs/fragments/fix_deperecated_ami.yml | 3 +++ .../targets/inventory_aws_ec2/playbooks/test_inventory_ssm.yml | 3 ++- tests/integration/targets/inventory_aws_ec2/tasks/setup.yml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/fix_deperecated_ami.yml diff --git a/changelogs/fragments/fix_deperecated_ami.yml b/changelogs/fragments/fix_deperecated_ami.yml new file mode 100644 index 00000000000..713ceab8979 --- /dev/null +++ b/changelogs/fragments/fix_deperecated_ami.yml @@ -0,0 +1,3 @@ +--- +trivial: + - Make the ami pattern generic to avoid searching for deprecated amis. diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_inventory_ssm.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_inventory_ssm.yml index 161fdc6e610..139a667b53a 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_inventory_ssm.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_inventory_ssm.yml @@ -18,7 +18,7 @@ vars: ami_details: owner: 125523088429 - name: Fedora-Cloud-Base-37-1.2.x86_64* + name: Fedora-Cloud-Base-37* user_data: | #!/bin/sh sudo dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm @@ -45,6 +45,7 @@ amazon.aws.ec2_ami_info: owners: '{{ ami_details.owner | default("amazon") }}' filters: + architecture: x86_64 name: "{{ ami_details.name }}" register: ec2_amis no_log: true diff --git a/tests/integration/targets/inventory_aws_ec2/tasks/setup.yml b/tests/integration/targets/inventory_aws_ec2/tasks/setup.yml index e970e48c8ac..f3945dc401a 100644 --- a/tests/integration/targets/inventory_aws_ec2/tasks/setup.yml +++ b/tests/integration/targets/inventory_aws_ec2/tasks/setup.yml @@ -7,7 +7,7 @@ owner-id: "125523088429" virtualization-type: hvm root-device-type: ebs - name: Fedora-Cloud-Base-37-1.2.x86_64* + name: Fedora-Cloud-Base-37* register: fedora_images - name: Set image id, vpc cidr and subnet cidr