Skip to content

Commit

Permalink
force reinstall plugins and fix pid file permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
spider-network committed Feb 20, 2016
1 parent 2603087 commit 153c67f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ A simple playbook can look like:
vars:
kibana_plugins:
- plugin: elastic/sense
- org: elastic
plugin: sense
version: latest
```


Expand Down
57 changes: 43 additions & 14 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,77 @@
---
- group:
- name: create user group
group:
name="{{ kibana_group }}"
state=present

- user:
- name: create user
user:
name="{{ kibana_user }}"
group="{{ kibana_group }}"
state=present
home=/var/lib/kibana

- get_url:
- name: download kibana
get_url:
url="{{ kibana_download_url }}"
dest="{{ kibana_download_target_dir }}/{{ kibana_download_url | basename }}"

- unarchive:
- name: extract kibana
unarchive:
src="{{ kibana_download_target_dir }}/{{ kibana_download_url | basename }}"
dest="{{ kibana_install_dir }}"
copy=no
owner="{{ kibana_user }}"
group="{{ kibana_group }}"

- file:
- name: symlink current kibana version
file:
path="{{ kibana_install_dir }}/kibana"
src="{{ kibana_install_dir }}/{{ kibana_download_url | basename | regex_replace('.zip|.tar.gz', '') }}"
owner="{{ kibana_user }}"
group="{{ kibana_group }}"
state=link

- file:
path="{{ item }}"
- name: create log directory
file:
path="{{ kibana_log | dirname }}"
owner="{{ kibana_user }}"
group="{{ kibana_group }}"
state=directory
mode=0744
with_items:
- "{{ kibana_log | dirname }}"
- "{{ kibana_config['pid.file'] }} | default('/var/run/kibana/kibana.pid') | dirname"
mode=0755

- file:
- name: create log file
file:
path="{{ kibana_log }}"
owner="{{ kibana_user }}"
group="{{ kibana_group }}"
state=touch
mode=0644

- set_fact:
pid_file=/var/run/kibana/kibana.pid

- set_fact:
pid_file="{{ kibana_config['pid.file'] }}"
when: kibana_config['pid.file'] is defined

- name: create pid file directory
file:
path="{{ pid_file | dirname }}"
owner="{{ kibana_user }}"
group="{{ kibana_group }}"
state=directory
mode=0755

- name: configure upstart
template:
src=etc/init/kibana.conf.j2
dest=/etc/init/kibana.conf
notify:
- restart kibana

- template:
- name: update kibana configuration
template:
src=kibana.yml.j2
dest="{{ kibana_install_dir }}/kibana/config/kibana.yml"
owner="{{ kibana_user }}"
Expand All @@ -60,8 +80,17 @@
notify:
- restart kibana

- name: uninstall plugins
command: "{{ kibana_install_dir }}/kibana/bin/kibana plugin --remove {{ item.plugin }}"
become: yes
become_user: "{{ kibana_user }}"
ignore_errors: yes
with_items: kibana_plugins
notify:
- restart kibana

- name: install plugins
command: "{{ kibana_install_dir }}/kibana/bin/kibana plugin --install {{ item.plugin }}"
command: "{{ kibana_install_dir }}/kibana/bin/kibana plugin --install {{ item.org }}/{{ item.plugin }}/{{ item.version }}"
become: yes
become_user: "{{ kibana_user }}"
ignore_errors: yes
Expand Down
2 changes: 1 addition & 1 deletion templates/kibana.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ kibana.index: ".kibana"

{% if kibana_config['pid.file'] is not defined %}
# Set the path to where you would like the process id file to be created.
pid.file: "/var/run/kibana/kibana.pid"
pid.file: "{{ pid_file }}"
{% endif %}

# If you are running kibana behind a proxy, and want to mount it at a path,
Expand Down

0 comments on commit 153c67f

Please sign in to comment.