I am trying to configure dynamic inventory in my ansible code with AWS
Here is the configuration in ansible.cfg
[defaults]
inventory = ./inventory/ec2.py
When I try to check to verify the host with ansible -m command -a "ls" all
i am getting the following error
[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 version:
ansible 2.4.3.0
executable location = /Users/<user-name>/Library/Python/2.7/bin/ansible