Tell ansible to don't escape quotes in shell

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)”

`

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.

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?

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.