Hi,
Alternatively you can use the "> notation" :

shell: >
  curl -X POST http://{{ influxdb.host }}:{{ influxdb_client_port
}}/db?u=root&p=root -d "{'name': 'spark-metrics'}"

Cheers
    Ulli
Am 30.04.2015 10:53 schrieb "Serega Sheypak" <[email protected]>:

> Hi, trying to execute task:
>
> - name: Create spark-metrics DB
>   shell: curl -X POST http://{{ influxdb.host }}:{{ influxdb_client_port
> }}/db?u=root&p=root -d "{'name': 'spark-metrics'}"
>
> Ansible dislikes ":"
>
> - name: Create spark-metrics DB
>   shell: curl -X POST http://{{ influxdb.host }}:{{ influxdb_client_port
> }}/db?u=root&p=root -d "{'name': 'spark-metrics'}"
>
>                               ^
> 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 }}"
>
>
> воскресенье, 3 ноября 2013 г., 17:46:37 UTC+1 пользователь Michael DeHaan
> написал:
>>
>> When you said you inserted outer quotes, the example you showed did not
>> show any outer quotes at all.
>>
>> I mean quote the entire value.
>>
>> Alternatively, see what Kahil wrote.
>>
>>
>>
>>
>> On Sat, Nov 2, 2013 at 11:27 AM, Anton Parkhomenko <[email protected]>
>> wrote:
>>
>>> Well, in that case I have syntactically correct YAML, but because Brian
>>> omitted outer single-quotes, it performs a wrong command. Verbose output:
>>>
>>> changed: [192.168.1.107] =>
>>> {"changed": true,
>>>  "cmd": ["mycommand", "subcommand", "--option={first-item:", *"2}"*],
>>>
>>>  "delta": "0:00:00.162754",
>>>  "end": "2013-11-02 15:08:57.654332",
>>>  "rc": 0, "start": "2013-11-02 15:08:57.491578",
>>>  "stderr": "upload: invalid arguments",
>>>  "stdout": "mycommand subcommand[OPTIONS]\n    --help     display help"}
>>>
>>>
>>> If I insert the outer quotes, the following error will appear:
>>>
>>> ERROR: Syntax Error while loading YAML script, playbook.yml
>>> Note: The error may actually appear before this position: line 53,
>>> column 73
>>>
>>>      - name: test escaping
>>>        command: mycommand subcommand --option="{'first-item': 2}""
>>>                                                ^
>>>
>>> Anyway, if I've missing something, this "something" is definetely about
>>> YAML syntax and not about Ansible and I should ask it somewhere
>>> else. Especially that my problem is already solved in other way.
>>>
>>> Thanks.
>>>
>>> On Saturday, November 2, 2013 11:05:31 PM UTC+8, Michael DeHaan wrote:
>>>
>>>> This is the "you have a free colon in your output, you must quote the
>>>> whole line, thing.
>>>>
>>>> So basically what Brian suggested above will take care of it.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Nov 2, 2013 at 10:38 AM, Anton Parkhomenko <[email protected]>
>>>> wrote:
>>>>
>>>>> I'm sorry for not including debug output, I saw this error so many
>>>>> times that already thought that it's pretty common. Ansible version is
>>>>> 1.3.3.
>>>>> The error was:
>>>>> ERROR: Syntax Error while loading YAML script, playbook.yml
>>>>> Note: The error may actually appear before this position: line 53,
>>>>> column 77
>>>>>
>>>>>      - name: test escaping
>>>>>        command: mycommand subcommand --option=\"{''first-item'': 2}\"
>>>>>                                                                ^
>>>>>
>>>>>  This actually shows that I have problems not with quotes and braces,
>>>>> but with colon. It's one of number of non-working examples. It was solved
>>>>> by embracing colon with single quotes.
>>>>> And working solution is:
>>>>>
>>>>>      - name: test escaping
>>>>>        command: mycommand subcommand --option=\"{first-item':'2}\"
>>>>>
>>>>> I removed space after colon, and removed single quotes, but I want
>>>>> solution that includes them, so I'm consider question is still open.
>>>>>
>>>>> --
>>>>> 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].
>>>>>
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Michael DeHaan <[email protected]>
>>>>
>>>> CTO, AnsibleWorks, Inc.
>>>> http://www.ansibleworks.com/
>>>>
>>>>   --
>>> 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].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Michael DeHaan <[email protected]>
>> CTO, AnsibleWorks, Inc.
>> http://www.ansibleworks.com/
>>
>>   --
> 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/f41d55cd-fb6a-4a7d-9dba-b09b4e061867%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f41d55cd-fb6a-4a7d-9dba-b09b4e061867%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/CAKEd4FNxc1M3feoTQk%3D3Hr9rsLNkjqm_3WWiD5o%2BccNDGmvuKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to