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
python ec2.py --list
Traceback (most recent call last):
File "ec2.py", line 134, in <module>
from ansible.module_utils import ec2 as ec2_utils
ImportError: No module named ansible.module_utils
EXPECTED RESULTS
A list of instances
ACTUAL RESULTS
Error above.
Workaround
If I comment out the line from ansible.module_utils import ec2 as ec2_utils the script runs fine.
@jonatanblue that import was added by 59e499f which appears to be an attempt to normalize the boto client setup code.
The implication is that in order to use the inventory script, you need to have ansible installed on the machine such that "ansible" is available in the python path for your default python interpreter. We plan to make more use of the ansible libraries in the dynamic inventory scripts over time, so I am not going to revert this change.
It may be worth mentioning this somewhere in the documentation, or have the script throw an informative error if ansible is not available in the python path.
ISSUE TYPE
COMPONENT NAME
Dynamic Inventory: ec2.py
ANSIBLE VERSION
OS / ENVIRONMENT
Mac OS X 10.11.6
SUMMARY
Running ec2.py standalone causes import error.
STEPS TO REPRODUCE
EXPECTED RESULTS
A list of instances
ACTUAL RESULTS
Error above.
Workaround
If I comment out the line
from ansible.module_utils import ec2 as ec2_utils
the script runs fine.The line was introduced in #16606.
The text was updated successfully, but these errors were encountered: