You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to build a RHEL 8 AMI using molecule using code that previously worked to build a RHEL 7 AMI. When I run the molecule script I currently experience the following error.
ERROR! couldn't resolve module/action 'ec2'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/home/joe/Programming/redacted-base-ami-rhel8/ansible/roles/molecule.ec2/tasks/create.yml'
Currently I don’t understand where Ansible looks for modules. Here’s what I understand about how Ansible looks for modules
1. a variable called “DEFAULT_MODULE_PATH” can be defined in the ansible.cfg. Currently this variable is undefined in my ansible.cfg vars in my virtual environment AND in the etc folder.
2. The environment variable ‘ANSIBLE_LIBRARY’ can be set in the shell. This variable is also already empty.
3. The first place Ansible looks is in the /library sub-directory where the top level playbook resides
4. modules associated with a role will be in the /library sub-directory associated with that role
5. if using a python virtual environment for ansible the module dependencies will be stored in “/home/<username>/.local/share/<Virtual Environment Name > /lib/python<version>/site-packages/ansible/modules”
If Ansible can’t find the correct EC2 module in any of these places, how do I find the correct one in Ansible Galaxy? Is there a way to step through a playbook to see where Ansible is loading modules/collections from?
How do I know if Ansible is looking for an EC2 module and not a module like molecule.ec2 where molecule is the namespace.
Here’s info about the two virtual environments I have setup
Virtual Environment to build RHEL 7 AMI that works
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I’m trying to build a RHEL 8 AMI using molecule using code that previously worked to build a RHEL 7 AMI. When I run the molecule script I currently experience the following error.
Currently I don’t understand where Ansible looks for modules. Here’s what I understand about how Ansible looks for modules
If Ansible can’t find the correct EC2 module in any of these places, how do I find the correct one in Ansible Galaxy? Is there a way to step through a playbook to see where Ansible is loading modules/collections from?
How do I know if Ansible is looking for an EC2 module and not a module like molecule.ec2 where molecule is the namespace.
Here’s info about the two virtual environments I have setup
Virtual Environment to build RHEL 7 AMI that works
ansible [core 2.13.5]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/joe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/joe/.local/share/virtualenvs/redacted-base-ami-1ZB9F3Kr/lib64/python3.9/site-packages/ansible
ansible collection location = /home/joe/.ansible/collections:/usr/share/ansible/collections
executable location = /home/joe/.local/share/virtualenvs/redacted-base-ami-1ZB9F3Kr/bin/ansible
python version = 3.9.13 (main, Nov 9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]
jinja version = 3.1.2
libyaml = True
Virtual Environment for RHEL 8 AMI build that currently doesn’t work.
ansible [core 2.14.1]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/joe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/joe/.local/share/virtualenvs/redacted-base-ami-rhel8-TVqD7V0E/lib64/python3.9/site-packages/ansible
ansible collection location = /home/joe/.ansible/collections:/usr/share/ansible/collections
executable location = /home/joe/.local/share/virtualenvs/redacted-base-ami-rhel8-TVqD7V0E/bin/ansible
python version = 3.9.13 (main, Nov 9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)] (/home/joe/.local/share/virtualenvs/redacted-base-ami-rhel8-TVqD7V0E/bin/python)
jinja version = 3.1.2
libyaml = True
Beta Was this translation helpful? Give feedback.
All reactions