Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

grafana.yml 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ---
  2. # Installs the Grafana Dashboard, as described in:
  3. # http://docs.grafana.org/installation/debian/
  4. # http://docs.grafana.org/installation/configuration/
  5. - name: Ensure repository key for Grafana is in place
  6. apt_key: url=https://packages.grafana.com/gpg.key state=present
  7. tags:
  8. - dependencies
  9. - name: Add Grafana repository
  10. apt_repository: repo="deb https://packages.grafana.com/oss/deb stable main"
  11. tags:
  12. - dependencies
  13. - name: Install Grafana from official repository
  14. apt:
  15. name: "{{ packages }}"
  16. state: present
  17. update_cache: yes
  18. vars:
  19. packages:
  20. - grafana
  21. tags:
  22. - dependencies
  23. - name: Configure Grafana
  24. template:
  25. src=etc_grafana_grafana.j2
  26. dest=/etc/grafana/grafana.ini
  27. owner=root
  28. group=grafana
  29. notify: restart grafana
  30. - name: Create Grafana data directory
  31. file: state=directory path=/data/grafana owner=grafana group=grafana
  32. - name: Add Grafana postgres user
  33. postgresql_user:
  34. login_host=localhost
  35. login_user={{ db_admin_username }}
  36. login_password="{{ db_admin_password }}"
  37. name={{ grafana_db_username }}
  38. password="{{ grafana_db_password }}"
  39. encrypted=yes
  40. state=present
  41. - name: Create Grafana database
  42. postgresql_db:
  43. login_host=localhost
  44. login_user={{ db_admin_username }}
  45. login_password="{{ db_admin_password }}"
  46. name={{ grafana_db_database }}
  47. state=present
  48. owner={{ grafana_db_username }}
  49. - name: Register new Grafana service
  50. systemd: name=grafana-server daemon_reload=yes enabled=yes
  51. - name: Start new Grafana instance
  52. service: name=grafana-server state=started
  53. - name: Create the Apache Grafana sites config files
  54. template:
  55. src=etc_apache2_sites-available_grafana.j2
  56. dest=/etc/apache2/sites-available/grafana_{{ item.name }}.conf
  57. owner=root
  58. group=root
  59. with_items: "{{ virtual_domains }}"
  60. notify: restart apache
  61. - name: Enable Apache sites (creates new sites-enabled symlinks)
  62. command: a2ensite grafana_{{ item }}.conf creates=/etc/apache2/sites-enabled/grafana_{{ item }}.conf
  63. notify: restart apache
  64. with_items: "{{ virtual_domains | json_query('[*].name') }}"