# Ansible 1.3.2 doesn't seem to work with ec2 samples?

**URL:** <https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 7, 2013, 11:05am UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619 "2013-10-07T11:05:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langford](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Simon\_Matic\_Langford](https://forum.ansible.com/u/Simon_Matic_Langford)\
**Post date:** [October 7, 2013, 11:05am UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/1 "2013-10-07T11:05:58Z")

</div>

Hi,

I’ve just clean installed ansible 1.3.2 from rquillo’s PPA on my Ubuntu 12.04 system.

I created a playbook file (ansible-ec2.yml) with the following contents from the ec2 module documentation:

# Launch instances, runs some tasks

# and then terminate them

- name: Create a sandbox instance  
hosts: localhost  
gather\_facts: False  
vars:  
keypair: langfords  
instance\_type: m1.small  
security\_group: sg-1edd3571  
image: ami-c7c0d6b3  
region: eu-west-1  
tasks:
- name: Launch instance  
local\_action: ec2 keypair={{ keypair }} group={{ security\_group }} instance\_type={{ instance\_type }} image={{ image }} wait=true region={{ region }}  
register: ec2
- name: Add new instance to host group  
local\_action: add\_host hostname={{ item.public\_ip }} groupname=launched  
with\_items: ec2.instances
- name: Wait for SSH to come up  
local\_action: wait\_for host={{ item.public\_dns\_name }} port=22 delay=60 timeout=320 state=started  
with\_items: ec2.instances

And my /etc/ansible/hosts has a single entry:  
localhost ansible\_connection=local

I run this and it fails. Similar posts on this list suggest I have out of date modules, but I don’t know where these might be or how they might have got there?  
langfords@langfords4$ ansible-playbook ansible-ec2.yaml -vvvv

PLAY [Create a sandbox instance] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [Launch instance] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-1381143657.34-222947650962172 && chmod a+rx $HOME/.ansible/tmp/ansible-1381143657.34-222947650962172 && echo $HOME/.ansible/tmp/ansible-1381143657.34-222947650962172’]  
\<127.0.0.1\> REMOTE\_MODULE ec2 keypair=langfords group=sg-1edd3571 instance\_type=m1.small image=ami-c7c0d6b3 wait=true region=eu-west-1  
\<127.0.0.1\> PUT /tmp/tmpocPJSL TO /home/langfords/.ansible/tmp/ansible-1381143657.34-222947650962172/ec2  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘/usr/bin/python /home/langfords/.ansible/tmp/ansible-1381143657.34-222947650962172/ec2; rm -rf /home/langfords/.ansible/tmp/ansible-1381143657.34-222947650962172/ \>/dev/null 2\>&1’]  
failed: [localhost] =\> {“failed”: true, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/home/langfords/.ansible/tmp/ansible-1381143657.34-222947650962172/ec2”, line 1549, in   
main()  
File “/home/langfords/.ansible/tmp/ansible-1381143657.34-222947650962172/ec2”, line 612, in main  
(instance\_dict\_array, new\_instance\_ids, changed) = create\_instances(module, ec2)  
File “/home/langfords/.ansible/tmp/ansible-1381143657.34-222947650962172/ec2”, line 437, in create\_instances  
res = ec2.run\_instances(\*\*params)  
TypeError: run\_instances() got an unexpected keyword argument ‘instance\_profile\_name’

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/langfords/ansible-ec2.yaml.retry

localhost : ok=0 changed=0 unreachable=0 failed=1

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [October 7, 2013, 11:53am UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/2 "2013-10-07T11:53:06Z")

</div>

How did you install ansible? The modules are (by default) installed in /usr/share/ansible, and it would appear that the cloud/ec2 file is out of date, as it’s erroring out on a new parameter that was added in 1.3.

---

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langford](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Simon\_Matic\_Langford](https://forum.ansible.com/u/Simon_Matic_Langford)\
**Post date:** [October 7, 2013, 8:57pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/3 "2013-10-07T20:57:46Z")

</div>

Hi James,

I added the Ubuntu PPA mentioned on this page: [http://www.ansibleworks.com/docs/intro\_installation.html](http://www.ansibleworks.com/docs/intro_installation.html)

And then just ran: sudo apt-get install ansible

Cheers  
Simon

---

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langfor1](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Simon\_Matic\_Langfor1](https://forum.ansible.com/u/Simon_Matic_Langfor1)\
**Post date:** [October 8, 2013, 8:56am UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/4 "2013-10-08T08:56:15Z")

</div>

Hi James,

I checked the folder you mentioned and it seems to know about the parameter:

langfords@langfords4:/usr/share/ansible/cloud$ pwd  
/usr/share/ansible/cloud  
langfords@langfords4:/usr/share/ansible/cloud$ cat ec2 | grep instance\_profile\_name  
instance\_profile\_name:  
instance\_profile\_name = module.params.get(‘instance\_profile\_name’)  
‘instance\_profile\_name’: instance\_profile\_name}  
instance\_profile\_name = dict(),

---

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langfor1](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Simon\_Matic\_Langfor1](https://forum.ansible.com/u/Simon_Matic_Langfor1)\
**Post date:** [October 8, 2013, 8:59am UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/5 "2013-10-08T08:59:47Z")

</div>

So, I tried to force the module dir on the command line, and now it appears the issue has gone away, to be replaced by an auth issue:

langfords@langfords4:~/Dropbox/work/clouddeploy$ ansible-playbook -M /usr/share/ansible -i /etc/ansible/hosts ansible-ec2.yaml -vvvv

PLAY [Create a sandbox instance] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [Launch instance] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-1381222473.64-270653428553926 && chmod a+rx $HOME/.ansible/tmp/ansible-1381222473.64-270653428553926 && echo $HOME/.ansible/tmp/ansible-1381222473.64-270653428553926’]  
\<127.0.0.1\> REMOTE\_MODULE ec2 keypair=langfords group=sg-1edd3571 instance\_type=m1.small image=ami-c7c0d6b3 wait=true region=eu-west-1  
\<127.0.0.1\> PUT /tmp/tmp0BjAph TO /home/langfords/.ansible/tmp/ansible-1381222473.64-270653428553926/ec2  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘/usr/bin/python /home/langfords/.ansible/tmp/ansible-1381222473.64-270653428553926/ec2; rm -rf /home/langfords/.ansible/tmp/ansible-1381222473.64-270653428553926/ \>/dev/null 2\>&1’]  
failed: [localhost] =\> {“failed”: true}  
msg: No handler was ready to authenticate. 1 handlers were checked. [‘QuerySignatureV2AuthHandler’] Check your credentials

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/langfords/ansible-ec2.yaml.retry

localhost : ok=0 changed=0 unreachable=0 failed=1

My /etc/ansible/hosts is still as below:  
localhost ansible\_connection=local

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [October 8, 2013, 3:20pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/6 "2013-10-08T15:20:32Z")

</div>

How have you configured your AWS credentials? Are you exporting them?

---

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langfor1](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Simon\_Matic\_Langfor1](https://forum.ansible.com/u/Simon_Matic_Langfor1)\
**Post date:** [October 8, 2013, 3:33pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/7 "2013-10-08T15:33:30Z")

</div>

Ah, oops… I’d switched terminal windows… right, so back to the original prob.

I’ve run with -M to force the location and it makes no difference:

langfords@langfords4:~/Dropbox/work/clouddeploy$ ./run\_ansible ansible-ec2.yaml -M /usr/share/ansible

PLAY [Create a sandbox instance] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [Launch instance] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [localhost] =\> {“failed”: true, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/home/langfords/.ansible/tmp/ansible-1381245971.29-257994512790004/ec2”, line 1549, in   
main()  
File “/home/langfords/.ansible/tmp/ansible-1381245971.29-257994512790004/ec2”, line 612, in main  
(instance\_dict\_array, new\_instance\_ids, changed) = create\_instances(module, ec2)  
File “/home/langfords/.ansible/tmp/ansible-1381245971.29-257994512790004/ec2”, line 437, in create\_instances  
res = ec2.run\_instances(\*\*params)  
TypeError: run\_instances() got an unexpected keyword argument ‘instance\_profile\_name’

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/langfords/ansible-ec2.yaml.retry

localhost : ok=0 changed=0 unreachable=0 failed=1

langfords@langfords4:~/Dropbox/work/clouddeploy$ cat /usr/share/ansible/cloud/ec2 | grep instance\_profile\_name  
instance\_profile\_name:  
instance\_profile\_name = module.params.get(‘instance\_profile\_name’)  
‘instance\_profile\_name’: instance\_profile\_name}  
instance\_profile\_name = dict(),

I got a hold of the 1.3.2 source and ran a diff between the two ec2 modules and get no diffs…

Is there anywhere else I can look to see what might be going on here? I don’t know python, so it’s hard for me to diagnose.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [October 8, 2013, 3:40pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/8 "2013-10-08T15:40:58Z")

</div>

What version of boto do you have installed? This actually appears to be an issue where that parameter is being sent into the boto function run\_instances(), but boto says it’s an invalid parameter name (it was introduced in boto 2.5.0).

---

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langfor1](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Simon\_Matic\_Langfor1](https://forum.ansible.com/u/Simon_Matic_Langfor1)\
**Post date:** [October 8, 2013, 3:50pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/9 "2013-10-08T15:50:13Z")

</div>

Right. I have boto 2.2.2, frustrating that the ansible deb didn’t flag this. Seems to be non-trivial to get an ubuntu PPA for 12.04 which has \>=2.5.0. Will find a way to get it on there and try again.

Thanks v much for you help.

Simon

---

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langfor1](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Simon\_Matic\_Langfor1](https://forum.ansible.com/u/Simon_Matic_Langfor1)\
**Post date:** [October 8, 2013, 3:55pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/10 "2013-10-08T15:55:28Z")

</div>

Yup, that worked great. Installed with pip and now it runs. Except…

msg: InvalidGroup.NotFound: The security group ‘sg-1edd3571’ does not exist in default VPC ‘vpc-a86e25c3’

I’ve double checked and that security group is most definitely assigned to that VPC, which is the default VPC, which raises 2 questions:

- Does ansible support VPC?

- And because I’m about to stop using my default VPC, does it support a non-default VPC?

Thanks  
Simon

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [October 8, 2013, 4:03pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/11 "2013-10-08T16:03:08Z")

</div>

The answer to both is yes, you should be able to specify the VPC with vpc\_subnet\_id. Do VPCs span regions in AWS? I’m a little bit ignorant of that detail myself, so it could be that the VPC you’ve defined isn’t in eu-west-1.

---

<div class="post-metadata">

**Author:** ![Simon\_Matic\_Langfor1](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Simon\_Matic\_Langfor1](https://forum.ansible.com/u/Simon_Matic_Langfor1)\
**Post date:** [October 8, 2013, 4:12pm UTC](https://forum.ansible.com/t/ansible-1-3-2-doesnt-seem-to-work-with-ec2-samples/13619/12 "2013-10-08T16:12:05Z")

</div>

They don’t AFAIK, but it’s defo in eu-west-1. I hadn’t seen the vpc\_subnet\_id. When I went and checked the doco I realised i was putting a group\_id into the group parameter. Sorted that out and it works.

Thanks for you help, I can delve a little further now.
