---

- name: add kibana repo
  apt_repository:
    repo: "deb http://packages.elastic.co/kibana/4.5/debian stable main"
  become: yes

- name: install kibana
  apt:
    name: kibana
    update_cache: yes
  become: yes

- name: copy kibana config
  template:
    src: kibana.yml
    dest: /opt/kibana/config/kibana.yml
    owner: root
    group: root
    mode: u=rw,g=rw,o=r
  become: yes
  register: config

- name: bounce kibana
  service:
    name: kibana
    state: restarted
  become: yes
  when: config.changed

- name: start kibana
  service:
    name: kibana
    state: started
  become: yes
