Kibana role

This commit is contained in:
Jérémy Lecour 2016-11-17 15:16:19 +01:00 committed by Jérémy Lecour
parent b9e5372d88
commit c51b29fb05
5 changed files with 109 additions and 2 deletions

14
kibana/README.md Normal file
View File

@ -0,0 +1,14 @@
# kibana
Install Kibana.
## Tasks
Everything is in the `tasks/main.yml` file.
## Available variables
The only variables are derived from gathered facts.
By default, Kibana will bind to localhost:5601.
If Nginx is installed, a typical proxy configuration is copied into `/etc/nginx/sites-available`. It can be tweeked and enabled by hand.

9
kibana/files/logrotate Normal file
View File

@ -0,0 +1,9 @@
/var/log/kibana/*.log {
daily
rotate 7
copytruncate
compress
delaycompress
missingok
notifempty
}

59
kibana/tasks/main.yml Normal file
View File

@ -0,0 +1,59 @@
---
- name: APT https transport is enabled
apt:
name: apt-transport-https
state: installed
tags:
- system
- packages
- name: Elastic GPG key is installed
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present
tags:
- system
- packages
- name: Elastic sources list is available
apt_repository:
repo: "deb https://artifacts.elastic.co/packages/5.x/apt stable main"
state: present
tags:
- system
- packages
- name: Kibana is installed
apt:
name: kibana
update_cache: yes
state: installed
tags:
- packages
- name: Kibana service is enabled and started
service:
name: kibana
enabled: yes
state: started
- name: Logrotate configuration is enabled
copy:
src: logrotate
dest: /etc/logrotate.d/kibana
mode: 0644
owner: root
group: root
- name: Nginx installed?
stat:
path: /etc/nginx/sites-available/
register: nginx_installed
- name: Example proxy for Kibana with Nginx
template:
src: nginx_proxy_kibana.j2
dest: /etc/nginx/sites-available/kibana.conf
force: no
when: nginx_installed.stat.exists

View File

@ -0,0 +1,24 @@
upstream kibana {
server 127.0.0.1:5601 fail_timeout=0;
}
server {
charset utf-8;
# ajouter les règles d'authentification
{% for address in ansible_all_ipv4_addresses %}
listen {{ address }}:80;
{% endfor %}
server_name {{ ansible_hostname }};
location / {
proxy_redirect off;
proxy_pass http://kibana/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
}
}

View File

@ -22,5 +22,6 @@
# }
# - apache
# - { role: elasticsearch, elasticsearch_custom_tmpdir: "/var/lib/elasticsearch/tmp" }
- elasticsearch
- elasticsearch-plugin-head
# - elasticsearch
# - elasticsearch-plugin-head
- kibana