# help with ec2.py usage

**URL:** <https://forum.ansible.com/t/help-with-ec2-py-usage/12791>\
**Category:** Ansible Project\
**Created:** [May 10, 2013, 6:10pm UTC](https://forum.ansible.com/t/help-with-ec2-py-usage/12791 "2013-05-10T18:10:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [May 10, 2013, 6:10pm UTC](https://forum.ansible.com/t/help-with-ec2-py-usage/12791/1 "2013-05-10T18:10:09Z")

</div>

Hi all,

Following the guide at [http://wiki.centos.org/Cloud/Manage/Ansible](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 ?

---

<div class="post-metadata">

**Author:** ![Lester\_Wade](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Lester\_Wade](https://forum.ansible.com/u/Lester_Wade)\
**Post date:** [May 10, 2013, 6:34pm UTC](https://forum.ansible.com/t/help-with-ec2-py-usage/12791/2 "2013-05-10T18:34:28Z")

</div>

See here for some documentation around the ec2 inventory plugin: [http://ansible.cc/docs/api.html#external-inventory-scripts](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
