DEV-315: fixed ansible error to get ansible-lint initially running

master
friedrich goerz 4 years ago committed by Görz, Friedrich
parent 591e40a283
commit 9ae762b6e1

@ -12,7 +12,7 @@
url: "https://{{ api_endpoint }}{{ api_path }}/_find?per_page=10000&type={{ es_object_type }}" url: "https://{{ api_endpoint }}{{ api_path }}/_find?per_page=10000&type={{ es_object_type }}"
method: GET method: GET
status_code: [200] status_code: [200]
user: "{{ elastic_admin_username_vault }}" user: "{{ elastic_admin_username_vault }}"
password: "{{ elastic_admin_password_vault }}" password: "{{ elastic_admin_password_vault }}"
force_basic_auth: yes force_basic_auth: yes
register: all_dashboards register: all_dashboards
@ -25,7 +25,7 @@
dashboard_query: "[?attributes.title=='{{ elastic_dashboard.attributes.title }}']" dashboard_query: "[?attributes.title=='{{ elastic_dashboard.attributes.title }}']"
- set_fact: - set_fact:
dashboard_exists: True dashboard_exists: True
when: when:
- lookup_dashboard_object | length > 0 - lookup_dashboard_object | length > 0
@ -41,7 +41,7 @@
delegate_to: localhost delegate_to: localhost
block: block:
- name: "Dashboards: Get all searches in elasticsearch" - name: "Dashboards: Get all searches in elasticsearch"
delegate_to: localhost delegate_to: localhost
uri: uri:
url: "https://{{ api_endpoint }}/s/{{ es_space }}/api/saved_objects/_find?per_page=10000&type=search" url: "https://{{ api_endpoint }}/s/{{ es_space }}/api/saved_objects/_find?per_page=10000&type=search"
method: GET method: GET
@ -51,18 +51,18 @@
force_basic_auth: yes force_basic_auth: yes
register: all_searches register: all_searches
become: false become: false
- set_fact: - set_fact:
lookup_search_object: '{{ all_searches.json | community.general.json_query(querystr1) | first | community.general.json_query(search_query) }}' lookup_search_object: '{{ all_searches.json | community.general.json_query(querystr1) | first | community.general.json_query(search_query) }}'
vars: vars:
querystr1: "[saved_objects[*]]" querystr1: "[saved_objects[*]]"
search_query: "[?attributes.title=='{{ elastic_dashboard.references[0].search_refname }}']" search_query: "[?attributes.title=='{{ elastic_dashboard.references[0].search_refname }}']"
- set_fact: - set_fact:
search_exists: True search_exists: True
when: when:
- lookup_search_object | length > 0 - lookup_search_object | length > 0
- debug: - debug:
msg: 'lookup_search_object{{ lookup_search_object }}' msg: 'lookup_search_object{{ lookup_search_object }}'
@ -70,11 +70,13 @@
panelindex_uuid: '{{ elastic_dashboard.references[0].search_refname | to_uuid }}' panelindex_uuid: '{{ elastic_dashboard.references[0].search_refname | to_uuid }}'
- name: "Doing evil string concatination with ansible in addition with variables" - name: "Doing evil string concatination with ansible in addition with variables"
delegate_to: localhost delegate_to: localhost
set_fact: 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 }}' 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: ref_obj_modified:
attributes: attributes:
title: '{{ elastic_dashboard.attributes.title }}' title: '{{ elastic_dashboard.attributes.title }}'
@ -82,7 +84,6 @@
references: references:
- -
name: '{{ panelindex_uuid }}' name: '{{ panelindex_uuid }}'
delegate_to: localhost
type: 'search' type: 'search'
id: '{{ lookup_search_object[0].id }}' id: '{{ lookup_search_object[0].id }}'
when: when:

@ -40,7 +40,7 @@
delegate_to: localhost delegate_to: localhost
block: block:
- name: "Get all indexpatterns in elasticsearch" - name: "Get all indexpatterns in elasticsearch"
delegate_to: localhost delegate_to: localhost
uri: uri:
url: "https://{{ api_endpoint }}/s/{{ es_space }}/api/saved_objects/_find?per_page=10000&type=index-pattern" url: "https://{{ api_endpoint }}/s/{{ es_space }}/api/saved_objects/_find?per_page=10000&type=index-pattern"
method: GET method: GET
@ -65,12 +65,13 @@
- debug: - debug:
msg: 'lookup_indexpattern_object:{{ lookup_indexpattern_object }}' msg: 'lookup_indexpattern_object:{{ lookup_indexpattern_object }}'
- set_fact: -
delegate_to: localhost
set_fact:
ref_obj_modified: ref_obj_modified:
references: references:
- -
name: '{{ elastic_search.references[0].name }}' name: '{{ elastic_search.references[0].name }}'
delegate_to: localhost
type: 'index-pattern' type: 'index-pattern'
id: '{{ lookup_indexpattern_object[0].id }}' id: '{{ lookup_indexpattern_object[0].id }}'
when: when:

Loading…
Cancel
Save