Kibana post_config checks only need to run locally

Recently added post_config for Kibana does some uri queries, these can
be problematic if run across every node.

Change-Id: I71d2611ae034ff2a85babb8d01419729f406a136
This commit is contained in:
Paul Bourke 2017-05-10 15:50:08 +01:00 committed by Paul Bourke (pbourke)
parent 350fab1005
commit 2d9a028cb0

View File

@ -1,24 +1,30 @@
--- ---
- name: Wait for kibana port - name: Wait for kibana port
wait_for: wait_for:
host: "{{ api_interface_address }}" host: "{{ kolla_internal_vip_address }}"
port: "{{ kibana_server_port }}" port: "{{ kibana_server_port }}"
run_once: true
connection: local
- name: Wait for kibana to register in elasticsearch - name: Wait for kibana to register in elasticsearch
uri: uri:
url: "{{ internal_protocol }}://{{ api_interface_address }}:{{ elasticsearch_port }}/.kibana" url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana"
status_code: 200 status_code: 200
register: result register: result
until: result.status == 200 until: result.status == 200
retries: 5 retries: 5
delay: 2 delay: 2
run_once: true
connection: local
- name: Get kibana default indexes - name: Get kibana default indexes
uri: uri:
HEADER_Content-Type: application/json HEADER_Content-Type: application/json
url: "{{ internal_protocol }}://{{ api_interface_address }}:{{ elasticsearch_port }}/.kibana" url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana"
method: GET method: GET
register: kibana_default_indexes register: kibana_default_indexes
run_once: true
connection: local
when: kibana_default_index is defined when: kibana_default_index is defined
- name: Set kibana default indexes fact - name: Set kibana default indexes fact
@ -26,14 +32,18 @@
kibana_default_indexes: "{{ kibana_default_indexes.json | default([]) }}" kibana_default_indexes: "{{ kibana_default_indexes.json | default([]) }}"
when: when:
- kibana_default_indexes is defined - kibana_default_indexes is defined
run_once: true
connection: local
- name: Add index pattern to kibana - name: Add index pattern to kibana
uri: uri:
url: "{{ internal_protocol }}://{{ api_interface_address }}:{{ elasticsearch_port }}/.kibana/index-pattern/{{ kibana_default_index_pattern }}" url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana/index-pattern/{{ kibana_default_index_pattern }}"
method: PUT method: PUT
body: "{{ kibana_default_index | to_json }}" body: "{{ kibana_default_index | to_json }}"
body_format: json body_format: json
status_code: 201 status_code: 201
run_once: true
connection: local
when: when:
- kibana_default_index is defined - kibana_default_index is defined
- kibana_default_indexes is defined - kibana_default_indexes is defined
@ -42,6 +52,8 @@
- name: Find kibana version - name: Find kibana version
command: docker exec -t kibana /opt/kibana/bin/kibana --version command: docker exec -t kibana /opt/kibana/bin/kibana --version
register: kibana_version register: kibana_version
run_once: true
changed_when: true
when: when:
- kibana_default_index is defined - kibana_default_index is defined
- kibana_default_indexes is defined - kibana_default_indexes is defined
@ -49,6 +61,8 @@
- set_fact: - set_fact:
kibana_version: "{{ kibana_version.stdout }}" kibana_version: "{{ kibana_version.stdout }}"
run_once: true
connection: local
when: when:
- kibana_default_index is defined - kibana_default_index is defined
- kibana_default_indexes is defined - kibana_default_indexes is defined
@ -56,12 +70,14 @@
- name: Change kibana config to set index as defaultIndex - name: Change kibana config to set index as defaultIndex
uri: uri:
url: "http://{{ api_interface_address }}:{{ elasticsearch_port }}/.kibana/config/{{ kibana_version }}" url: "http://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana/config/{{ kibana_version }}"
method: PUT method: PUT
body: body:
defaultIndex: "{{ kibana_default_index_pattern }}" defaultIndex: "{{ kibana_default_index_pattern }}"
body_format: json body_format: json
status_code: 200 status_code: 200
run_once: true
connection: local
when: when:
- kibana_default_index is defined - kibana_default_index is defined
- kibana_default_indexes is defined - kibana_default_indexes is defined