# Cloudformation module does not read the template file with .json extension

**URL:** <https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410>\
**Category:** Ansible Project\
**Created:** [February 1, 2016, 7:57pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410 "2016-02-01T19:57:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [February 1, 2016, 7:57pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/1 "2016-02-01T19:57:40Z")

</div>

I am working with the following script and I have got an error. Saying that your file is not found. Although my file is already there.

What could be the possible problem ?

Script:

…

cas\_cloud.yml

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 1, 2016, 8:45pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/2 "2016-02-01T20:45:33Z")

</div>

where is the file cassandra.json? what directory and which machine  
(the one executing ansible or the target)?

also note that:  
&nbsp;&nbsp;&nbsp;command: "echo /Users/suthata/Downloads/playbooks/ansible/cassandra.json"

does not test that the file is there, it just prints out the path.

---

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [February 1, 2016, 8:52pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/3 "2016-02-01T20:52:02Z")

</div>

Hi Brian,

I have tried the “cassandra.json” file with the following paths:

/Users/suthata/Downloads/playbooks/ansible/cassandra.json  
and /Users/suthata/Downloads/playbooks/cassandra.json…Still no directory found error.

I am running ansible on following path: /Users/suthata/Downloads/playbooks/ansible/cas\_cloud.yml…

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 1, 2016, 9:31pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/4 "2016-02-01T21:31:34Z")

</div>

you did not respond the other 1/2 of the question, is the file on the  
machine you are executing ansible on or on the 'target'?

---

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [February 1, 2016, 9:38pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/5 "2016-02-01T21:38:46Z")

</div>

I am executing the cloud formation template file on the remote machine or i want to implement all the resource on the remote machine from the template itself. Path I have set up is on the local side and it will implement it on the remote side.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 1, 2016, 9:45pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/6 "2016-02-01T21:45:34Z")

</div>

that is your problem, the module executes on the remote machine, the  
file is not there, you can either make it a 'local\_action' as this is  
an API call and should work from any machine. But if you need to run  
it from THAT specific machine you'll need to copy the file to it  
first.

---

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [February 1, 2016, 10:05pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/7 "2016-02-01T22:05:24Z")

</div>

Here I have modified. Now getting some other error.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 1, 2016, 10:15pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/8 "2016-02-01T22:15:19Z")

</div>

That seems to be an issue with cloud authentication, are you setup on  
the machine you run ansible from?

---

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [February 1, 2016, 10:26pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/9 "2016-02-01T22:26:03Z")

</div>

Yes. I have exported the environment variable AWS\_ACCESS\_KEY and AWS\_SECRET\_ACCESS\_KEY for my remote AWS machine. Earlier it was “boto” error. Now it is showing the credential error. What could be the possible problem ?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 1, 2016, 10:59pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/10 "2016-02-01T22:59:10Z")

</div>

if you export them on the remote machine, you won't have them on the local one

boto is a required library for the module and MUST be present on the  
machine you execute the module on.

There are always 2 machines involved with ansible tasks, the machine  
you run 'ansible' on and the machine that runs the task itself.  
normally the task runs on the remote target, exceptions to this are  
when targeting localhost or using 'local\_action/delegate\_to: localhost  
or connection: local'

You seem to be confusing both hosts, I believe you want to execute the  
cloudformation task (really an API call) for the target host but it  
should run on your ansible 'master'. You need boto and authentication  
working on that machine.

---

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [February 1, 2016, 11:10pm UTC](https://forum.ansible.com/t/cloudformation-module-does-not-read-the-template-file-with-json-extension/20410/11 "2016-02-01T23:10:27Z")

</div>

Perfect. Now its done it successfully. Thanks for your help. Really appreciate…!!!
