# How to Import a Kibana Dashboard with Ansible? - update

**URL:** <https://discuss.elastic.co/t/how-to-import-a-kibana-dashboard-with-ansible-update/326939>\
**Category:** Kibana\
**Created:** [March 3, 2023, 1:04pm UTC](https://discuss.elastic.co/t/how-to-import-a-kibana-dashboard-with-ansible-update/326939 "2023-03-03T13:04:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pyton](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@pyton](https://discuss.elastic.co/u/pyton)\
**Post date:** [March 3, 2023, 1:04pm UTC](https://discuss.elastic.co/t/how-to-import-a-kibana-dashboard-with-ansible-update/326939/1 "2023-03-03T13:04:14Z")

</div>

Hi i have update to closed thread -\> [How to Import a Kibana Dashboard with Ansible?](https://discuss.elastic.co/t/how-to-import-a-kibana-dashboard-with-ansible/324487) . I have been able to solve that nicely - ansible way.

```auto
- name: Install custom dashboards
  ansible.builtin.uri:
    url: "{{ kibana_endpoint }}/api/saved_objects/_import?overwrite=true"
    method: POST
    body_format: form-multipart
    body:
      file:
        filename: "{{ item }}.ndjson"
        content: "{{ lookup('ansible.builtin.file', file_name_to_upload) }}"
        mime_type: application/octet-stream
    headers:
      kbn-xsrf: "reporting"
    validate_certs: yes
    return_content: yes
    user: "{{ kibana_user }}"
    password: "{{ kibana_password }}"
    force_basic_auth: yes
    status_code: [200]
  vars: 
    file_name_to_upload: "{{ item }}.ndjson"
  loop: "{{ dashboards }}

```

---

<div class="post-metadata">

**Author:** ![silentfilm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/silentfilm/32/44348_2.png) [@silentfilm](https://discuss.elastic.co/u/silentfilm)\
**Post date:** [March 3, 2023, 3:27pm UTC](https://discuss.elastic.co/t/how-to-import-a-kibana-dashboard-with-ansible-update/326939/2 "2023-03-03T15:27:20Z")

</div>

Thanks for this solution. It won't currently work for me as my system is on Ansible 2.9 and doesn't support a body\_format of form-multipart. But I'll keep it in mind when we upgrade Ansible.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 31, 2023, 3:27pm UTC](https://discuss.elastic.co/t/how-to-import-a-kibana-dashboard-with-ansible-update/326939/3 "2023-03-31T15:27:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
