我在星期三安装了最新的mac os更新10.15.7,此后,我烦躁的动态清单停止工作。我最初怀疑是安装了多个python的问题,后来才知道Mac内部开发工具需要Python 2.7和3.7。我的目前使用的是Python 3.8.6,并且所有pip软件包均已安装。
这一直有效,直到我安装了mac更新。
下面是完整的堆栈跟踪错误。
$ ansible help -vvv
ansible 2.10.2
config file = /Users/vamshisiddarthgaddam/workspace/_ansible/ansible.cfg
configured module search path = ['/Users/vamshisiddarthgaddam/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.8.6 (default, Oct 8 2020, 14:06:32) [Clang 12.0.0 (clang-1200.0.32.2)]
Using /Users/vamshisiddarthgaddam/workspace/_ansible/ansible.cfg as config file
redirecting (type: inventory) ansible.builtin.aws_ec2 to amazon.aws.aws_ec2
ERROR! Unexpected Exception, this is probably a bug: No module named 'ansible.plugins.inventory.aws_ec2'
the full traceback was:
Traceback (most recent call last):
File "/usr/local/bin/ansible", line 123, in <module>
exit_code = cli.run()
File "/usr/local/lib/python3.8/site-packages/ansible/cli/adhoc.py", line 97, in run
loader, inventory, variable_manager = self._play_prereqs()
File "/usr/local/lib/python3.8/site-packages/ansible/cli/__init__.py", line 467, in _play_prereqs
inventory = InventoryManager(loader=loader, sources=options['inventory'])
File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 166, in __init__
self.parse_sources(cache=True)
File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 224, in parse_sources
parse = self.parse_source(source, cache=cache)
File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 263, in parse_source
parsed_this_one = self.parse_source(fullpath, cache=cache)
File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 275, in parse_source
for plugin in self._fetch_inventory_plugins():
File "/usr/local/lib/python3.8/site-packages/ansible/inventory/manager.py", line 203, in _fetch_inventory_plugins
plugin = inventory_loader.get(name)
File "/usr/local/lib/python3.8/site-packages/ansible/plugins/loader.py", line 780, in get
return self.get_with_context(name, *args, **kwargs).object
File "/usr/local/lib/python3.8/site-packages/ansible/plugins/loader.py", line 800, in get_with_context
self._module_cache[path] = self._load_module_source(name, path)
File "/usr/local/lib/python3.8/site-packages/ansible/plugins/loader.py", line 764, in _load_module_source
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/vamshisiddarthgaddam/workspace/_ansible/lib/plugins/inventory_plugins/aws_ec2_custom.py", line 3, in <module>
from ansible.plugins.inventory.aws_ec2 import *
ModuleNotFoundError: No module named 'ansible.plugins.inventory.aws_ec2'
让我知道是否有人能够解决此问题。 TIA:)
答案 0 :(得分:2)
您正在使用ansible 2.10。 ec2广告资源插件已不再是核心ansible的一部分。您需要安装相应的集合:
ansible-galaxy collection install amazon.aws
参考:https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html