We are upgrading from 7.9.3 to 7.17.8. I see that the method to import Kibana dashboards has changed. I can successfully import a dashboard using curl and using Postman.
curl -k -u <username>:<password> -X POST https://aln-nbadev4.labs.netscout.com:5601/api/saved_objects/_import?overwrite=true -H 'kbn-xsrf: true' --form file=@roles/kibana/files/database-monitor.ndjson
We normally install our dashboards using Ansible and it worked great using the old /api/kibana/dashboards/import URL. However, I can't figure out how to get Ansible to work correctly to install a dashboard with this new API.
- name: Load Kibana dashboards
uri:
url: "{{kibana_url}}/api/saved_objects/_import?overwrite=true"
method: POST
headers:
kbn-version: "{{es_stack_version}}"
kbn-xsrf: true
body-format: raw
user: "{{user.name}}"
password: "{{user.password}}"
force_basic_auth: yes
validate_certs: no
body: "file=@{{item}}"
with_items:
- database-monitor.ndjson
run_once: True
When I try this I get:
msg: 'Status code was 415 and not [200]: HTTP Error 415: Unsupported Media Type'