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
--------------
---
- name: Create Cloudformation Template for Cassandra Servers
hosts: awsserver
gather_facts: no
tasks:
- name: Cloudformation | Cloudformation template location
command: "echo /Users/suthata/Downloads/playbooks/ansible/cassandra.json"
register: template_location
- name: Cloudformation | Full path to cloudformation template
debug: var=template_location.stdout
- name: Cloudformation | Use the module cloudformation
cloudformation:
stack_name: "imdev-omniavpc-securitygroup"
state: "present"
region: "us-east-1"
template: cassandra.json
args:
template_parameters:
Environment: "imdev"
VpcCidr: "10.123.0.0/16"
VpcId: "vpc-4ec51e1b"
VpcName: "omniavpc"
tags:
revision: "1.0"
type: "security group"
Output:
PLAY [Create Cloudformation Template for Cassandra Servers] ********************
TASK [Cloudformation | Cloudformation template location] ***********************
changed: [52.90.52.201]
TASK [Cloudformation | Full path to cloudformation template] *******************
ok: [52.90.52.201] => {
"changed": false,
"template_location.stdout": "/Users/suthata/Downloads/playbooks/ansible/cassandra.json"
}
TASK [Cloudformation | Use the module cloudformation] **************************
fatal: [52.90.52.201]: FAILED! => {"changed": false, "failed": true, "msg": "Traceback (most recent call last):\r\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1454356045.33-97534776320654/cloudformation\", line 2535, in <module>\r\n main()\r\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1454356045.33-97534776320654/cloudformation\", line 273, in main\r\n template_body = open(module.params['template'], 'r').read()\r\nIOError: [Errno 2] No such file or directory: 'cassandra.json'\r\n", "parsed": false}
PLAY RECAP *********************************************************************
52.90.52.201 : ok=2 changed=1 unreachable=0 failed=1
---
- name: Create Cloudformation Template for Cassandra Servers
hosts: awsserver
sudo: yes
gather_facts: no
tasks:
- name: Cloudformation | Use the module cloudformation
local_action:
module: cloudformation
stack_name: "imdev-omniavpc-securitygroup"
region: "us-east-1"
state: "present"
template: "cassandra.json"
# template_format: "json"
VpcId: "vpc-4ec48e2b"
VpcName: "omniavpc"
tags:
revision: "1.0"
type: "security group"
Output:
PLAY [Create Cloudformation Template for Cassandra Servers] ********************
TASK [Cloudformation | Use the module cloudformation] **************************
fatal: [52.90.239.23 -> localhost]: FAILED! => {"changed": false, "failed": true, "msg": "No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV4Handler'] Check your credentials"}