# Strange behaviour of cloudformation module

**URL:** <https://forum.ansible.com/t/strange-behaviour-of-cloudformation-module/18034>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [April 21, 2015, 10:36am UTC](https://forum.ansible.com/t/strange-behaviour-of-cloudformation-module/18034 "2015-04-21T10:36:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cosbug](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@cosbug](https://forum.ansible.com/u/cosbug)\
**Post date:** [April 21, 2015, 10:36am UTC](https://forum.ansible.com/t/strange-behaviour-of-cloudformation-module/18034/1 "2015-04-21T10:36:16Z")

</div>

Hi All,

I wrote a cloud formation template which works fine from AWS console (tested many times).  
When I run it through Ansible cloudformation module for the first time to create resources - it works fine (state: present).  
Then if I set “state: absent” to delete earlier created resources it runs as fine as well.  
If now I try to run it once again with (state: present) it fails with no specific error (seems to time out).

Here is the config:

---

<div class="post-metadata">

**Author:** ![cosbug](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@cosbug](https://forum.ansible.com/u/cosbug)\
**Post date:** [April 21, 2015, 11:54am UTC](https://forum.ansible.com/t/strange-behaviour-of-cloudformation-module/18034/2 "2015-04-21T11:54:37Z")

</div>

Here is what I get if I try to use pdb:

`  
[root@test ansible]# python -m pdb /usr/bin/ansible-playbook /etc/ansible/aws-cf-provision.yml -vvvv

> /usr/bin/ansible-playbook(21)()  
> → **requires** = [‘ansible’]  
> (Pdb) c

PLAY [localhost] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [Create VPC, internet gateway, route tables and security groups] \*\*\*\*\*\*\*\*  
 REMOTE\_MODULE cloudformation template=VPCStack.json state=present region=eu-west-1 stack\_name=VPCStack-dev aws\_access\_key=\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* aws\_secret\_key=\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
 EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429616502.13-78952020926458 && echo $HOME/.ansible/tmp/ansible-tmp-1429616502.13-78952020926458’]  
 PUT /tmp/tmpVB40IM TO /root/.ansible/tmp/ansible-tmp-1429616502.13-78952020926458/cloudformation  
 EXEC [‘/bin/sh’, ‘-c’, u’LANG=C LC\_CTYPE=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1429616502.13-78952020926458/cloudformation; rm -rf /root/.ansible/tmp/ansible-tmp-1429616502.13-78952020926458/ \>/dev/null 2\>&1’]  
failed: [localhost] =\> {“failed”: true}

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Create VPC, internet gateway, route tables and security groups -------- 451.89s  
to retry, use: --limit @/root/aws-cf-provision.retry

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

The program exited via sys.exit(). Exit status: 2

> /usr/bin/ansible-playbook(21)()  
> → **requires** = [‘ansible’]  
> (Pdb)q  
> `

Any thoughts?
