Curl Command Equivalent in Ansible

Dear Team,

I am trying to use uri module in ansible, can anybody help me with that.

Actual Command:

curl -XPUT --insecure -u admin:admin “https://127.0.0.1:9640/*/_settings” -H ‘Content-Type: application/json’ -d ‘{ “index” : { “refresh_interval” : “180s” } }’

Ansible URI Module:

Should you be putting your data payload from curl in a ‘body’ tag?

uri:
url: https://127.0.0.1:9640/*/_settings
method: PUT
user: admin
password: admin
force_basic_auth: no
return_content: yes
body_format: json
validate_certs: no
headers:
Content-Type: “application/json”
Accept: “application/json”
body: “{ "index": { "refresh_interval": "180s" } }”

Hope that helps,

Jim

Hi,

I guess you are missing the “body” keyword such as :

uri:
url: https://127.0.0.1:9640/*/_settings
method: PUT
user: admin
password: admin
force_basic_auth: no
return_content: yes
body_format: json
validate_certs: no
headers:
Content-Type: “application/json”
Accept: “application/json”
body:
index:
refresh_interval: 180s

Thanks to let us know

Ludo

Thank you very much my problem got resolved… :slight_smile: