main.yml 882 B

1234567891011121314151617181920212223242526272829303132
  1. - include_vars: passwords.yml
  2. - name: install required packages for grafana
  3. apt:
  4. pkg: "{{ item }}"
  5. update_cache: yes
  6. cache_valid_time: 900
  7. state: installed
  8. with_items:
  9. - apt-transport-https
  10. - name: Add repo key for grafana (packagecloud.io)
  11. apt_key: id=D59097AB url=https://packagecloud.io/gpg.key state=present
  12. - name: add repo for grafana
  13. apt_repository: repo='deb https://packagecloud.io/grafana/stable/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }} main' state=present
  14. - name: install grafana
  15. apt:
  16. pkg: "grafana"
  17. update_cache: yes
  18. cache_valid_time: 900
  19. state: installed
  20. - name: configure collectd.conf
  21. template: src=grafana.ini.j2 dest=/etc/grafana/grafana.ini
  22. notify:
  23. - restart grafana-server
  24. - name: Start and enable grafana
  25. service: name=grafana-server state=started enabled=yes