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

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

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

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

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

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…

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'?

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.

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.

Here I have modified. Now getting some other error.

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

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 ?

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.

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