ansible-community/molecule-plugins

ec2 plugin utilizes amazon.aws collection exclusive feature but only lists community.aws as dependency

aroberts87 opened this issue · 1 comments

While trying to update the ec2 plugin to utilize FQCN syntax similar to what was done in PR #105, I stumbled into the following issue. The create.yml cookiecutter file lists community.aws collections as a dependency, but references the ec2_ami_info module that appears to only exist in amazon.aws.

Attempting to use community.aws

?> ansible-galaxy collection list

# /home/.../.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.aws     5.4.0  
community.crypto  2.11.1 
community.general 7.0.0  

- name: Look up EC2 AMI(s) by owner and name (if image not set)
  community.aws.ec2_ami_info:
    owners: "{{ item.image_owner }}"
    filters: "{{ item.image_filters | default({}) | combine(image_name_map) }}"
  vars:
    image_name_map: "{% if item.image_name is defined and item.image_name | length > 0 %}{{ { 'name': item.image_name } }}{% else %}{}{% endif %}"
  loop: "{{ platforms }}"
  loop_control:
    label: "{{ item.name }}"
  when: not item.image
  register: ami_info
ERROR! couldn't resolve module/action 'ec2_ami_info'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/.../molecule/default/create.yml': line 137, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


    - name: Look up EC2 AMI(s) by owner and name (if image not set)
      ^ here

Installing and using amazon.aws

?> ansible-galaxy collection list

# /home/.../.ansible/collections/ansible_collections
Collection        Version
----------------- -------
amazon.aws        5.4.0  
community.crypto  2.11.1 
community.general 7.0.0
- name: Look up EC2 AMI(s) by owner and name (if image not set)
  amazon.aws.ec2_ami_info:
    owners: "{{ item.image_owner }}"
    filters: "{{ item.image_filters | default({}) | combine(image_name_map) }}"
  vars:
    image_name_map: "{% if item.image_name is defined and item.image_name | length > 0 %}{{ { 'name': item.image_name } }}{% else %}{}{% endif %}"
  loop: "{{ platforms }}"
  loop_control:
    label: "{{ item.name }}"
  when: not item.image
  register: ami_info
TASK [Look up EC2 AMI(s) by owner and name (if image not set)] *****************
ok: [localhost] => (item=my-ec2-instance)

This issues seems to be confirmed by looking at the collection documentation as well. The ec2_ami_info module is listed in the documentation for amazon.aws, but is absent in community.aws.
community.aws docs: https://docs.ansible.com/ansible/latest/collections/community/aws/index.html
amazon.aws docs: https://docs.ansible.com/ansible/latest/collections/amazon/aws/index.html

Can you please check if current git HEAD is fine, so that we can close this bug ?