Open pfuntner opened 2 years ago
Files identified in the description:
plugins/modules/ec2_metadata_facts.py
](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/ec2_metadata_facts.py)If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @jillr @roadmapper @s-hertel @silviud @tremble click here for bot help
I believe Ansible is installed in the container with:
pip install ansible==6.4.0 ansible-core==2.13.4
I upgraded amazon.aws
but it didn't help:
jenkins@da845f528eb6:~$ ansible-galaxy collection install amazon.aws
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/download/amazon-aws-4.2.0.tar.gz to /home/jenkins/.ansible/tmp/ansible-local-719yuij_o2r/tmp0nzcvmaf/amazon-aws-4.2.0-_fj1uw6f
Installing 'amazon.aws:4.2.0' to '/home/jenkins/.ansible/collections/ansible_collections/amazon/aws'
amazon.aws:4.2.0 was installed successfully
jenkins@da845f528eb6:~$
I noticed that the target is running Python 2.7 so I did the following:
/usr/bin/python
symlink to point to Python 3So it appears the module is having trouble with Python 2.
Same behavior has been observed on Centos 7 as well. This is my fix:
- name: Ensure python3 is installed
ansible.builtin.yum:
name: python3
state: present
- name: Get instance ec2 facts
ec2_metadata_facts:
vars:
ansible_python_interpreter: python3
@pfuntner @madrover I believe https://github.com/ansible-collections/amazon.aws/pull/943 may fix this. It has been backported to both 3.x and 4.x but neither have a new release, yet. 5.0.0 was just released today, however.
Summary
When I try to use the
ec2_metadata_facts
module against an EL7 instance such as CentOS 7, I get this an exception:Issue Type
Bug Report
Component Name
ec2_metadata_facts
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Steps to Reproduce
Playbook
Expected Results
The module should not throw an exception.
Actual Results
Code of Conduct