- name: install adduser
  apt:
    name: adduser
    update_cache: yes
    cache_valid_time: 3600

- name: install libfontconfig
  apt:
    name: libfontconfig
    update_cache: yes
    cache_valid_time: 3600

- name: install grafana 3.1.1 stable
  apt:
    deb: https://grafanarel.s3.amazonaws.com/builds/grafana_3.1.1-1470047149_amd64.deb

- name: Copy grafana.ini
  copy:
    src: grafana.ini
    dest: /etc/grafana/grafana.ini
    mode: 0640
    owner: root
    group: grafana

- name: allow Grafana to bind low number ports
  shell: setcap 'cap_net_bind_service=+ep' /usr/sbin/grafana-server

- name: Start Grafana
  service:
    name: grafana-server
    state: started

- name: make Grafana start on boot
  shell: update-rc.d grafana-server defaults 95 10
