never mind. I should have read the whole thread .

On Tuesday, April 12, 2016 at 4:12:46 PM UTC-4, Ryan Groten wrote:
>
> I must be close, but it's not working with uri module.  Here's what I put 
> in the role.  Setting the uri_body as a fact beforehand and using "to_json" 
> was an attempt to get around the error I'm getting, but that doesn't help 
> either.
>
> - name: Set uri_body (workaround)
>   set_fact:
>     uri_body:
>       transient:
>         cluster.routing.allocation.enable: "none"
>
> - name: Disable shard allocation to prevent es from rebalancing missing 
> shards
>   uri:
>     url: "http://localhost:9200/_cluster/settings";
>     method: PUT
>     body: "{{ uri_body | to_json }}"
>     body_format: json
>
> When I run it I get this:
>
> fatal: [vm2.example.com]: FAILED! => {"changed": false, "failed": true, 
> "module_stderr": "", "module_stdout": "Traceback (most recent call 
> last):\r\n  File \"/tmp/ansible-tmp-1460491268.69-8119459959976/uri\", line 
> 3363, in <module>\r\n    main()\r\n  File 
> \"/tmp/ansible-tmp-1460491268.69-8119459959976/uri\", line 374, in main\r\n 
>    dict_headers['Content-Type'] = 'application/json'\r\nTypeError: 
> 'NoneType' object does not support item assignment\r\n", "msg": "MODULE 
> FAILURE", "parsed": false}
>
>
> On Tuesday, 12 April 2016 09:42:09 UTC-6, Matt Martz wrote:
>>
>> I know this isn't really a direct answer to your question, but why not 
>> use the `uri` module instead?
>>
>> - uri:
>>     url: "http://localhost:9200/_cluster/settings";
>>     method: PUT
>>     body:
>>       transient:
>>         cluster.routing.allocation.enable: "none"
>>     body_format: json
>>
>> On Tue, Apr 12, 2016 at 10:29 AM, Ryan Groten <[email protected]> wrote:
>>
>>> I am trying to execute a task that runs the following command (which 
>>> includes a number of quote, brackets, colons, etc):
>>>
>>> command: curl -XPUT "http://localhost:9200/_cluster/settings"; -d'{ 
>>> "transient" : { "cluster.routing.allocation.enable" : "none" } }'
>>>
>>> I tried escaping all the quotes and {}, but that doesn't seem to work.  
>>>
>>> command: 'curl -XPUT "http://localhost:9200/_cluster/settings"; -d\'\{ 
>>> "transient" : \{ "cluster.routing.allocation.enable" : "none" \} \}''
>>>
>>> I also tried treating the whole command as a jinja string (I think?)
>>>
>>> command: {{ 'curl -XPUT "http://localhost:9200/_cluster/settings"; -d'{ 
>>> "transient" : { "cluster.routing.allocation.enable" : "none" } }'' }}
>>>
>>> Thanks,
>>> Ryan
>>>
>>> -- 
>>> 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/ef4f9432-a75e-4ab1-91f1-487c8e0a68a4%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/ef4f9432-a75e-4ab1-91f1-487c8e0a68a4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Matt Martz
>> @sivel
>> sivel.net
>>
>

-- 
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/c3d64424-e8a2-43eb-8328-4985fa6b8272%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to