# Tell ansible to don't escape quotes in shell

**URL:** <https://forum.ansible.com/t/tell-ansible-to-dont-escape-quotes-in-shell/18424>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [June 7, 2015, 2:10pm UTC](https://forum.ansible.com/t/tell-ansible-to-dont-escape-quotes-in-shell/18424 "2015-06-07T14:10:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno\_Galindro\_da\_Co](https://avatars.discourse-cdn.com/v4/letter/b/59ef9b/32.png) [@Bruno\_Galindro\_da\_Co](https://forum.ansible.com/u/Bruno_Galindro_da_Co)\
**Post date:** [June 7, 2015, 2:10pm UTC](https://forum.ansible.com/t/tell-ansible-to-dont-escape-quotes-in-shell/18424/1 "2015-06-07T14:10:30Z")

</div>

How can I tell to ansible to execute this command in shell without double quote escaping?

`

- name: Configure S3 bucket for website  
shell: aws s3api put-bucket-website --bucket {{ item }} --website-configuration “$(\< /tmp/s3\_config\_{{ item }}.json)”  
with\_items: frontend\_s3\_buckets  
environment:  
AWS\_ACCESS\_KEY\_ID: “{{ ansible\_aws\_access\_key\_id }}”  
AWS\_SECRET\_ACCESS\_KEY: “{{ ansible\_aws\_secret\_access\_key }}”  
tags:
- frontend\_s3

`

My problem is: when the command is executed, it is sent to shell with double quotes escaped:

`  
TASK: [frontend\_s3 | Configure S3 bucket for website] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [54.94.253.5] =\> (item=teste.socialbase.com.br) =\> {“changed”: true, “cmd”: “aws s3api put-bucket-website --bucket teste.socialbase.com.br --website-configuration **"** $(\< /tmp/s3\_config\_test.json) **"** ”, “delta”: “0:00:00.199463”, “end”: “2015-06-07 13:54:28.956900”, “item”: “teste.socialbase.com.br”, “rc”: 255, “start”: “2015-06-07 13:54:28.757437”, “warnings”: }  
stderr:  
string index out of range

FATAL: all hosts have already failed – aborting

`

It is executing as follows:

` `  
aws s3api put-bucket-website --bucket {{ item }} --website-configuration "$(\< /tmp/s3\_config\_test.json)"

` `

But I need that it execute the command without double quote escaping, as follows:

`  
aws s3api put-bucket-website --bucket {{ item }} --website-configuration “$(\< /tmp/s3\_config\_test.json)”

`

---

<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:** [June 8, 2015, 2:17pm UTC](https://forum.ansible.com/t/tell-ansible-to-dont-escape-quotes-in-shell/18424/2 "2015-06-08T14:17:17Z")

</div>

it needs to be escaped as it runt throush shell + ssh + shell +shell,  
but it should end up being exactly what you put in, but it does print  
to debug a quoted version that is being fed through the pipeline.

---

<div class="post-metadata">

**Author:** ![Bruno\_Galindro\_da\_Co](https://avatars.discourse-cdn.com/v4/letter/b/59ef9b/32.png) [@Bruno\_Galindro\_da\_Co](https://forum.ansible.com/u/Bruno_Galindro_da_Co)\
**Post date:** [June 19, 2015, 4:47pm UTC](https://forum.ansible.com/t/tell-ansible-to-dont-escape-quotes-in-shell/18424/3 "2015-06-19T16:47:36Z")

</div>

Sorry but I don’t understand what do you said. I’ve made a workarround: copy a templated script to remote host and executing it there.

You are saying that it is impossible to do this task as I tried before? If no, how would you solve this problem without using a script?

---

<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:** [June 19, 2015, 4:49pm UTC](https://forum.ansible.com/t/tell-ansible-to-dont-escape-quotes-in-shell/18424/4 "2015-06-19T16:49:07Z")

</div>

No, I'm saying the escaping in needed for your command line to survive  
the transport to the end shell, but that the escapes should be  
stripped out by then.
