我正在尝试使用AWS的ansible代码配置动态清单
这是ansible.cfg
[defaults]
inventory = ./inventory/ec2.py
当我尝试使用ansible -m command -a "ls" all
检查主机时,出现以下错误
[WARNING]: * Failed to parse /Users/Shammon/Projects/ansible/inventory/ec2.py with script plugin: Inventory script
(/Users/Shammon/Projects/ansible/inventory/ec2.py) had an execution error: Traceback (most recent call last): File
"/Users/Shammon/Projects/ansible/inventory/ec2.py", line 135, in <module> from ansible.module_utils import ec2 as ec2_utils
ModuleNotFoundError: No module named 'ansible'
[WARNING]: * Failed to parse /Users/<user-name>/Projects/ansible/inventory/ec2.py with ini plugin:
/Users/<name>/Projects/ansible/inventory/ec2.py:3: Error parsing host definition ''''': No closing quotation
[WARNING]: Unable to parse /Users/<user-name>/Projects/ansible/inventory/ec2.py as an inventory source
Ansible版本:
ansible 2.4.3.0
executable location = /Users/<user-name>/Library/Python/2.7/bin/ansible