help with ec2.py usage

Hi all,

Following the guide at http://wiki.centos.org/Cloud/Manage/Ansible I’m trying to use the ec2.py to create an inventory of my running ec2 instances.

How should I use ec2.py ? do I have to take the command output and create a host file ?

I’v been able to run ec2.py successfully and created a file ec2_host from the output. When I’m trying to run the bellow command I get an error :

ansible -i ec2_host -u root -m raw -a “hostname” security_group_test

“”"

Traceback (most recent call last):
File “/usr/bin/ansible”, line 157, in
(runner, results) = cli.run(options, args)
File “/usr/bin/ansible”, line 83, in run
inventory_manager = inventory.Inventory(options.inventory)
File “/usr/lib/python2.6/site-packages/ansible/inventory/init.py”, line 91, in init
self.parser = InventoryParser(filename=host_list)
File “/usr/lib/python2.6/site-packages/ansible/inventory/ini.py”, line 40, in init
self._parse()
File “/usr/lib/python2.6/site-packages/ansible/inventory/ini.py”, line 44, in _parse
self._parse_base_groups()
File “/usr/lib/python2.6/site-packages/ansible/inventory/ini.py”, line 114, in _parse_base_groups
(k,v) = t.split(“=”)
ValueError: need more than 1 value to unpack

“”"

Any help ?

See here for some documentation around the ec2 inventory plugin: http://ansible.cc/docs/api.html#external-inventory-scripts

No need to output to a file, just run:

./ec2.py

Then address one of the groupings with:

ansible -i ec2.py security_group_test -m mymodule -a myargs