How to Import a Kibana Dashboard with Ansible? - update

Hi i have update to closed thread -> How to Import a Kibana Dashboard with Ansible? . I have been able to solve that nicely - ansible way.

- 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 }}
1 Like

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.

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