I have problems to make it working the ec2.py script for dynamic inventory.
Installed ansible on CentOS 7:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum --enablerepo=epel install ansible
Configure a simple hosts file and ssl key access. Running ansible:
ansible all -m ping
Get the expected output. Ansible is working.
Installed aws-cli:
wget -q https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
unzip awscli-bundle.zip
./awscli-bundle/install -i /opt/aws -b /usr/bin/aws
Configure credentials file in ~/.aws. Running aws:
aws ec2 describe-instances
Get the expected output. Aws-cli is working.
Installed boto.
yum --enablerepo=epel install python2-boto
Downloaded ec2.py and ec2.ini from links as in the official documentation (http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script). Running it I get the following error:
[root@vm09 ansible]# ./ec2.py --list
Traceback (most recent call last):
File "./ec2.py", line 1642, in <module>
Ec2Inventory()
File "./ec2.py", line 193, in __init__
self.do_api_calls_update_cache()
File "./ec2.py", line 525, in do_api_calls_update_cache
self.get_instances_by_region(region)
File "./ec2.py", line 615, in get_instances_by_region
self.add_instance(instance, region)
File "./ec2.py", line 934, in add_instance
if self.group_by_platform:
AttributeError: 'Ec2Inventory' object has no attribute 'group_by_platform'
Tried to install ansible from git and with pip, same as boto. Always get the same error.
What I am missing here?
devel
version of ec2.py script? I'd better try with github.com/ansible/ansible/blob/v2.3.1.0-1/contrib/inventory/… – Konstantin Suvorov