diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index d0ec8472f9..121d988473 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -122,6 +122,9 @@ rgw_port: "6780" mistral_api_port: "8989" +kibana_port: "5601" +elasticsearch_port: "9200" + #################### # Openstack options #################### @@ -174,7 +177,7 @@ enable_murano: "no" enable_ironic: "no" enable_magnum: "no" enable_mistral: "no" - +enable_elk: "no" ironic_keystone_user: "ironic" # Nova fake driver and the number of fake driver per compute node diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 0eb841b545..344ff0f279 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -15,6 +15,9 @@ localhost ansible_connection=local # You can explicitly specify which hosts run each project by updating the # groups in the sections below. Common services are grouped together. +[kibana:children] +control + [haproxy:children] network diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 6b2302f4fa..828b0447a2 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -27,6 +27,9 @@ storage01 # You can explicitly specify which hosts run each project by updating the # groups in the sections below. Common services are grouped together. +[kibana:children] +control + [haproxy:children] network diff --git a/ansible/roles/kibana/defaults/main.yml b/ansible/roles/kibana/defaults/main.yml new file mode 100644 index 0000000000..be14a522e1 --- /dev/null +++ b/ansible/roles/kibana/defaults/main.yml @@ -0,0 +1,24 @@ +--- +#################### +# Kibana +#################### +kibana_port: "{{ kibana_port }}" +kibana_host: "{{ kolla_internal_address }}" +kibana_app_id: "discover" +kibana_request_timeout: 300000 +kibana_shard_timeout: 0 +kibana_verify_ssl: false + + +#################### +# Docker +#################### +kibana_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-kibana" +kibana_tag: "{{ openstack_release }}" +kibana_image_full: "{{ kibana_image }}:{{ kibana_tag }}" + + +#################### +# Elasticsearch +#################### +elasticsearch_preserve_host: "true" diff --git a/ansible/roles/kibana/meta/main.yml b/ansible/roles/kibana/meta/main.yml new file mode 100644 index 0000000000..6b4fff8fef --- /dev/null +++ b/ansible/roles/kibana/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - { role: common } diff --git a/ansible/roles/kibana/tasks/config.yml b/ansible/roles/kibana/tasks/config.yml new file mode 100644 index 0000000000..edccb229c5 --- /dev/null +++ b/ansible/roles/kibana/tasks/config.yml @@ -0,0 +1,22 @@ +--- +- name: Ensuring kibana config directories exist + file: + path: "{{ node_config_directory }}/{{ item }}" + state: "directory" + recurse: yes + with_items: + - "kibana" + +- name: Copying over config.json files for services + template: + src: "{{ item }}.json.j2" + dest: "{{ node_config_directory }}/{{ item }}/config.json" + with_items: + - "kibana" + +- name: Copying over Kibana configuration file + template: + src: "{{ item }}.yml.j2" + dest: "{{ node_config_directory }}/{{ item }}/{{ item }}.yml" + with_items: + - "kibana" diff --git a/ansible/roles/kibana/tasks/deploy.yml b/ansible/roles/kibana/tasks/deploy.yml new file mode 100644 index 0000000000..1f16915ad9 --- /dev/null +++ b/ansible/roles/kibana/tasks/deploy.yml @@ -0,0 +1,4 @@ +--- +- include: config.yml + +- include: start.yml diff --git a/ansible/roles/kibana/tasks/main.yml b/ansible/roles/kibana/tasks/main.yml new file mode 100644 index 0000000000..b017e8b4ad --- /dev/null +++ b/ansible/roles/kibana/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include: "{{ action }}.yml" diff --git a/ansible/roles/kibana/tasks/pull.yml b/ansible/roles/kibana/tasks/pull.yml new file mode 100644 index 0000000000..b97d0029d3 --- /dev/null +++ b/ansible/roles/kibana/tasks/pull.yml @@ -0,0 +1,5 @@ +- name: Pulling Kibana image + kolla_docker: + action: "pull_image" + common_options: "{{ docker_common_options }}" + image: "{{ kibana_image_full }}" diff --git a/ansible/roles/kibana/tasks/start.yml b/ansible/roles/kibana/tasks/start.yml new file mode 100644 index 0000000000..104ff8e371 --- /dev/null +++ b/ansible/roles/kibana/tasks/start.yml @@ -0,0 +1,9 @@ +--- +- name: Starting Kibana container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ kibana_image_full }}" + name: "kibana" + volumes: + - "{{ node_config_directory }}/kibana/:{{ container_config_directory }}/:ro" diff --git a/ansible/roles/kibana/templates/kibana.json.j2 b/ansible/roles/kibana/templates/kibana.json.j2 new file mode 100644 index 0000000000..9410a07d96 --- /dev/null +++ b/ansible/roles/kibana/templates/kibana.json.j2 @@ -0,0 +1,11 @@ +{ + "command": "/opt/kibana/bin/kibana", + "config_files": [ + { + "source": "{{ container_config_directory }}/kibana.yml", + "dest": "/opt/kibana/config/kibana.yml", + "owner": "kibana", + "perm": "0640" + } + ] +} diff --git a/ansible/roles/kibana/templates/kibana.yml.j2 b/ansible/roles/kibana/templates/kibana.yml.j2 new file mode 100644 index 0000000000..e144a1b5be --- /dev/null +++ b/ansible/roles/kibana/templates/kibana.yml.j2 @@ -0,0 +1,19 @@ +port: {{ kibana_port }} +host: {{ kibana_host }} +elasticsearch_url: "http://{{ kolla_internal_address }}:{{ elasticsearch_port }}" +elasticsearch_preserve_host: {{ elasticsearch_preserve_host }} +default_app_id: {{ kibana_app_id }} +request_timeout: {{ kibana_request_timeout }} +shard_timeout: {{ kibana_shard_timeout }} +verify_ssl: {{ kibana_verify_ssl }} +bundled_plugin_ids: + - plugins/dashboard/index + - plugins/discover/index + - plugins/doc/index + - plugins/kibana/index + - plugins/markdown_vis/index + - plugins/metric_vis/index + - plugins/settings/index + - plugins/table_vis/index + - plugins/vis_types/index + - plugins/visualize/index diff --git a/ansible/site.yml b/ansible/site.yml index e4f7ff9645..e7f62740ac 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -26,6 +26,12 @@ tags: haproxy, when: enable_haproxy | bool } +- hosts: kibana + roles: + - { role: kibana, + tags: kibana, + when: enable_elk | bool } + - hosts: memcached roles: - { role: memcached, diff --git a/docker/kibana/Dockerfile.j2 b/docker/kibana/Dockerfile.j2 new file mode 100644 index 0000000000..3868e3a8dc --- /dev/null +++ b/docker/kibana/Dockerfile.j2 @@ -0,0 +1,19 @@ +FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }} +MAINTAINER {{ maintainer }} + +ENV KIBANA_VERSION 4.3.1 +ENV KIBANA_DIR /opt/kibana/ +ENV KIBANA_ARCHIVE kibana-${KIBANA_VERSION}-linux-x64.tar.gz + +RUN useradd -r -m --user-group kibana \ + && usermod -a -G kolla kibana + +RUN curl "https://download.elastic.co/kibana/kibana/$KIBANA_ARCHIVE" -o $KIBANA_ARCHIVE \ + && mkdir -p $KIBANA_DIR \ + && tar -xz --strip-components=1 -f $KIBANA_ARCHIVE -C $KIBANA_DIR \ + && chown -R kibana:kibana $KIBANA_DIR \ + && rm -f $KIBANA_ARCHIVE + +{{ include_footer }} + +USER kibana