diff --git a/roles/kibana/tasks/_configure_dashboards.yml b/roles/kibana/tasks/_configure_dashboards.yml index ff7b8bc..68f6d3a 100644 --- a/roles/kibana/tasks/_configure_dashboards.yml +++ b/roles/kibana/tasks/_configure_dashboards.yml @@ -12,7 +12,7 @@ url: "https://{{ api_endpoint }}{{ api_path }}/_find?per_page=10000&type={{ es_object_type }}" method: GET status_code: [200] - user: "{{ elastic_admin_username_vault }}" + user: "{{ elastic_admin_username_vault }}" password: "{{ elastic_admin_password_vault }}" force_basic_auth: yes register: all_dashboards @@ -25,7 +25,7 @@ dashboard_query: "[?attributes.title=='{{ elastic_dashboard.attributes.title }}']" - set_fact: - dashboard_exists: True + dashboard_exists: True when: - lookup_dashboard_object | length > 0 @@ -41,7 +41,7 @@ delegate_to: localhost block: - name: "Dashboards: Get all searches in elasticsearch" - delegate_to: localhost + delegate_to: localhost uri: url: "https://{{ api_endpoint }}/s/{{ es_space }}/api/saved_objects/_find?per_page=10000&type=search" method: GET @@ -51,18 +51,18 @@ force_basic_auth: yes register: all_searches become: false - + - set_fact: lookup_search_object: '{{ all_searches.json | community.general.json_query(querystr1) | first | community.general.json_query(search_query) }}' vars: querystr1: "[saved_objects[*]]" search_query: "[?attributes.title=='{{ elastic_dashboard.references[0].search_refname }}']" - + - set_fact: - search_exists: True + search_exists: True when: - lookup_search_object | length > 0 - + - debug: msg: 'lookup_search_object{{ lookup_search_object }}' @@ -70,11 +70,13 @@ panelindex_uuid: '{{ elastic_dashboard.references[0].search_refname | to_uuid }}' - name: "Doing evil string concatination with ansible in addition with variables" - delegate_to: localhost + delegate_to: localhost set_fact: panelsJSON: '{{ (''[{"version":"7.16.1","type":"search","gridData":{"x":0,"y":0,"w":48,"h":28,"i":"'' + ( panelindex_uuid | string ) + ''"},"panelIndex":"'' + ( panelindex_uuid | string ) + ''","embeddableConfig":{"enhancements":{}},"panelRefName":"panel_'' + ( panelindex_uuid | string ) + ''"}]'') | string }}' - - set_fact: + - + delegate_to: localhost + set_fact: ref_obj_modified: attributes: title: '{{ elastic_dashboard.attributes.title }}' @@ -82,7 +84,6 @@ references: - name: '{{ panelindex_uuid }}' - delegate_to: localhost type: 'search' id: '{{ lookup_search_object[0].id }}' when: diff --git a/roles/kibana/tasks/_configure_searches.yml b/roles/kibana/tasks/_configure_searches.yml index 696e610..3b22675 100644 --- a/roles/kibana/tasks/_configure_searches.yml +++ b/roles/kibana/tasks/_configure_searches.yml @@ -40,7 +40,7 @@ delegate_to: localhost block: - name: "Get all indexpatterns in elasticsearch" - delegate_to: localhost + delegate_to: localhost uri: url: "https://{{ api_endpoint }}/s/{{ es_space }}/api/saved_objects/_find?per_page=10000&type=index-pattern" method: GET @@ -65,12 +65,13 @@ - debug: msg: 'lookup_indexpattern_object:{{ lookup_indexpattern_object }}' - - set_fact: + - + delegate_to: localhost + set_fact: ref_obj_modified: references: - name: '{{ elastic_search.references[0].name }}' - delegate_to: localhost type: 'index-pattern' id: '{{ lookup_indexpattern_object[0].id }}' when: