You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
---
|
|
- set_fact:
|
|
api_path: '/s/{{ es_space }}/api/saved_objects'
|
|
|
|
- name: "Import smardigo default dashboard and its related objects (index-pattern,search)"
|
|
delegate_to: localhost
|
|
set_fact:
|
|
es_import_objects: "{{ lookup('template','smardigo_default_objects.json.j2') }}"
|
|
when:
|
|
- elastic_state == 'present'
|
|
|
|
- name: "Print objects to local file"
|
|
delegate_to: localhost
|
|
copy:
|
|
dest: '/tmp/es_objects_ready_to_import__objects.ndjson'
|
|
content: '{{ es_import_objects }}'
|
|
when:
|
|
- elastic_state == 'present'
|
|
|
|
- name: "Import elastic objects ..."
|
|
delegate_to: localhost
|
|
uri:
|
|
url: "https://{{ api_endpoint }}{{ api_path }}/_import?overwrite=true"
|
|
method: POST
|
|
status_code: [200]
|
|
user: "{{ elastic_admin_username_vault }}"
|
|
password: "{{ elastic_admin_password_vault }}"
|
|
force_basic_auth: yes
|
|
headers:
|
|
kbn-xsrf: true
|
|
body_format: form-multipart
|
|
body:
|
|
file:
|
|
filename: '/tmp/es_objects_ready_to_import__objects.ndjson'
|
|
mime_type: 'application/octet-stream'
|
|
become: false
|
|
when:
|
|
- elastic_state == 'present'
|
|
|
|
- name: "Remove temporarily created file"
|
|
delegate_to: localhost
|
|
file:
|
|
state: absent
|
|
path: '/tmp/es_objects_ready_to_import__objects.ndjson'
|
|
when:
|
|
- elastic_state == 'present'
|
|
|
|
|
|
- name: "Set default indexpattern ..."
|
|
delegate_to: localhost
|
|
uri:
|
|
url: "https://{{ api_endpoint }}/s/dev-fgrz/api/kibana/settings"
|
|
method: POST
|
|
status_code: [200]
|
|
user: "{{ elastic_admin_username_vault }}"
|
|
password: "{{ elastic_admin_password_vault }}"
|
|
force_basic_auth: yes
|
|
headers:
|
|
kbn-xsrf: true
|
|
body_format: json
|
|
body:
|
|
changes:
|
|
defaultIndex: '{{ es_indexpattern_uuid }}'
|
|
become: false
|
|
when:
|
|
- elastic_state == 'present'
|