Hi guys,
I solved the issue with the following adjustments:
- name: Sending Stash to Sensu - {{ item }}
uri:
url=http://10.0.0.8:4567/stashes
method=POST
body_format=json
body='{"path":"silence/{{ item }}","content":{"reason":"Automatic
Scale Down"},"expire":28800}'
status_code=201
HEADER_Content-Type="application/json"
with_items: c3_imagens_name
tags:
- stash
Thanks !
On Tue, Jun 23, 2015 at 9:44 AM, Erick Vitor de Barros <
[email protected]> wrote:
> Hi Rob,
>
> thanks for your reply. I'll try that.
>
> On Mon, Jun 22, 2015 at 8:44 PM, Rob White <[email protected]> wrote:
>
>> Escape your double quotes
>>
>> body="{\"path\": \"silence/{{ item }}\",\"content\": {\"reason\":
>> \"Automatic Scale Down\"},\"expire\": 28800}"
>>
>> On Tuesday, 23 June 2015 06:45:41 UTC+10, Erick Barros wrote:
>>>
>>> Hi guys,
>>>
>>> this is the first time I ever use the "uri_module" and I'm facing a
>>> problem that I just can't solve.. here it is
>>>
>>> - name: Sending Stash to Sensu - {{ item }}
>>> uri:
>>> url=http://10.0.0.8:4567/stashes
>>> method=POST
>>> body_format=json
>>> body="{"path": "silence/{{ item }}","content": {"reason":
>>> "Automatic Scale Down"},"expire": 28800}"
>>> HEADER_Content-Type="application/json;charset=utf-8"
>>> status_code=200
>>> with_items:
>>> - c3_imagens_name
>>> tags:
>>> - stash
>>>
>>> When I try to execute this piece of code I got the following error:
>>>
>>> ERROR: Syntax Error while loading YAML script, ec2_rotate_imagens.yml
>>> Note: The error may actually appear before this position: line 76,
>>> column 22
>>>
>>> body_format=json
>>> body="{"path": "silence/{{ item }}","content": {"reason":
>>> "Automatic Scale Down"},"expire": 28800}"
>>> ^
>>> We could be wrong, but this one looks like it might be an issue with
>>> missing quotes. Always quote template expression brackets when they
>>> start a value. For instance:
>>>
>>> with_items:
>>> - {{ foo }}
>>>
>>> Should be written as:
>>>
>>> with_items:
>>> - "{{ foo }}"
>>>
>>> I'm trying to POST something like this (using curl):
>>>
>>> /usr/bin/curl -XPOST 'http://10.0.0.8:4567/stashes' -d '{
>>> "path": "silence/ip-10-0-4-217",
>>> "content": {
>>> "reason": "Automatic Scale Down"
>>> },
>>> "expire": 28800
>>> }'
>>>
>>>
>>> Could you please guys give me some help?
>>>
>>> Thanks in advance
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/652cd914-f243-4007-998c-fbef23f831c4%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/652cd914-f243-4007-998c-fbef23f831c4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAKz6g-3YTCBKYrZ-3TCxc8%3D1BxNO9xPYauHdLd2_r7z7hqBiQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.