aboutsummaryrefslogblamecommitdiffstats
path: root/roles/grafana/tasks/main.yml
blob: d002b5183ee6f8c0993712af2797f8a7912fdb99 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                       


                  
 
                                         
       
                                        

                                
                
                    




               
 

                                      
                           
                          


                
 
                                     
           




                                                           

                                        



                    
- name: install grafana
  package:
    name: grafana
    state: present

- name: ensure grafana directories exists
  file:
    path: "{{ grafana_dir }}/{{ item }}"
    owner: "{{ grafana_user }}"
    group: "{{ grafana_group }}"
    mode: "0640"
    state: directory
  loop:
    - ""
    - "data"
    - "logs"
    - "plugins"

- name: generate grafana configuration
  template:
    src: etc-grafana.ini.j2
    dest: /etc/grafana.ini
    owner: "0"
    group: "0"
    mode: "0644"

- name: generate grafana data sources
  template:
    src: datasources-default.yml.j2
    dest: /etc/grafana/provisioning/datasources/default.yml
    owner: "{{ grafana_user }}"
    group: "{{ grafana_group }}"
    mode: "0640"

- name: start and enable grafana service
  service:
    name: grafana
    state: restarted
    enabled: true
remember that computers suck.