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}