
Delegate executing uri REST methods to the current module containers using kolla_toolbox. This will allow self signed certificate that are already copied into the container to be automatically validated. This circumvents requiring Kolla Ansible to explicitly disable certificate validation in the ansible uri module. Partially-Implements: blueprint custom-cacerts Change-Id: I2625db7b8000af980e4745734c834c5d9292290b
88 lines
2.8 KiB
YAML
88 lines
2.8 KiB
YAML
---
|
|
- name: Wait for kibana port
|
|
wait_for:
|
|
host: "{{ kolla_internal_vip_address }}"
|
|
port: "{{ kibana_server_port }}"
|
|
run_once: true
|
|
|
|
- name: Register the kibana index in elasticsearch
|
|
become: true
|
|
kolla_toolbox:
|
|
module_name: uri
|
|
module_args:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address | put_address_in_context('url') }}:{{ elasticsearch_port }}/.kibana"
|
|
method: PUT
|
|
body: "{{ kibana_default_index_options | to_json }}"
|
|
body_format: json
|
|
status_code: 200, 201, 400
|
|
register: result
|
|
failed_when:
|
|
# If the index already exists, Elasticsearch will respond with a 400 error.
|
|
- result.status == 400
|
|
# Format: {"json": {"error": {"type": "index_already_exists_exception"}}}
|
|
- result.get('json', {}).get('error', {}).get('type') != 'index_already_exists_exception'
|
|
run_once: true
|
|
|
|
- name: Wait for kibana to register in elasticsearch
|
|
become: true
|
|
kolla_toolbox:
|
|
module_name: uri
|
|
module_args:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address | put_address_in_context('url') }}:{{ elasticsearch_port }}/.kibana"
|
|
status_code: 200
|
|
register: result
|
|
until: result.status == 200
|
|
retries: 20
|
|
delay: 2
|
|
run_once: true
|
|
|
|
- name: Change kibana config to set index as defaultIndex
|
|
become: true
|
|
kolla_toolbox:
|
|
module_name: uri
|
|
module_args:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address | put_address_in_context('url') }}:{{ elasticsearch_port }}/.kibana/config/*"
|
|
method: PUT
|
|
body:
|
|
defaultIndex: "{{ kibana_default_index_pattern }}"
|
|
body_format: json
|
|
status_code: 200, 201
|
|
run_once: true
|
|
|
|
- name: Get kibana default indexes
|
|
become: true
|
|
kolla_toolbox:
|
|
module_name: uri
|
|
module_args:
|
|
headers:
|
|
Content-Type: application/json
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address | put_address_in_context('url') }}:{{ elasticsearch_port }}/.kibana"
|
|
method: GET
|
|
register: kibana_default_indexes
|
|
run_once: true
|
|
when: kibana_default_index is defined
|
|
|
|
- name: Set kibana default indexes fact
|
|
set_fact:
|
|
kibana_default_indexes: "{{ kibana_default_indexes.json | default([]) }}"
|
|
when:
|
|
- kibana_default_indexes is defined
|
|
run_once: true
|
|
connection: local
|
|
|
|
- name: Add index pattern to kibana
|
|
become: true
|
|
kolla_toolbox:
|
|
module_name: uri
|
|
module_args:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address | put_address_in_context('url') }}:{{ elasticsearch_port }}/.kibana/index-pattern/{{ kibana_default_index_pattern }}"
|
|
method: PUT
|
|
body: "{{ kibana_default_index | to_json }}"
|
|
body_format: json
|
|
status_code: 201
|
|
run_once: true
|
|
when:
|
|
- kibana_default_index is defined
|
|
- kibana_default_indexes is defined
|
|
- kibana_default_indexes['.kibana']['mappings']['config']['properties']['defaultIndex'] is not defined
|