prometheus/server/tasks/main.yaml
changeset 187 0f3a64c60ec5
parent 181 2b30d081dd9b
child 189 3bd85e235e76
equal deleted inserted replaced
186:c48761176ede 187:0f3a64c60ec5
     9   apt_repository: repo="deb https://packages.grafana.com/oss/deb stable main"
     9   apt_repository: repo="deb https://packages.grafana.com/oss/deb stable main"
    10 
    10 
    11 - name: install prometheus and grafana
    11 - name: install prometheus and grafana
    12   become: yes
    12   become: yes
    13   apt: name="{{prometheus_server_apt_packages}}" state="latest"
    13   apt: name="{{prometheus_server_apt_packages}}" state="latest"
       
    14 
       
    15 - name: make prometheus data dir
       
    16   become: yes
       
    17   file:
       
    18     path: "{{prometheus_server_data_dir}}"
       
    19     state: "directory"
       
    20     owner: "prometheus"
       
    21     group: "prometheus"
       
    22     recurse: yes
       
    23   notify: restart prometheus service
       
    24 
       
    25 - name: configure prometheus data dir
       
    26   become: yes
       
    27   lineinfile:
       
    28     path: "/etc/default/prometheus"
       
    29     regexp: '^ARGS="'
       
    30     line: 'ARGS="--storage.tsdb.path={{prometheus_server_data_dir}}"'
       
    31   notify: restart prometheus service
    14 
    32 
    15 - name: configure prometheus
    33 - name: configure prometheus
    16   become: yes
    34   become: yes
    17   template:
    35   template:
    18     src: "{{prometheus_server_conf}}"
    36     src: "{{prometheus_server_conf}}"
    35 #     ds_url: "http://localhost:9090"
    53 #     ds_url: "http://localhost:9090"
    36 #     grafana_url: "http://localhost:3000"
    54 #     grafana_url: "http://localhost:3000"
    37 #     is_default: yes
    55 #     is_default: yes
    38 #   changed_when: false
    56 #   changed_when: false
    39 
    57 
    40 - name: install grafana plugins
    58 # - name: install grafana plugins
    41   become: yes
    59 #   become: yes
    42   grafana_plugin: name="{{item}}"
    60 #   grafana_plugin: name="{{item}}"
    43   loop: "{{prometheus_server_grafana_plugins}}"
    61 #   loop: "{{prometheus_server_grafana_plugins}}"
    44 
    62 
    45 - name: copy dashboards to target
    63 - name: copy dashboards to target
    46   become: yes
    64   become: yes
    47   copy:
    65   copy:
    48     src: "{{prometheus_server_grafana_dashboard_src}}/{{item}}"
    66     src: "{{prometheus_server_grafana_dashboard_src}}/{{item}}"
    49     dest: "/tmp/"
    67     dest: "/tmp/"
    50     mode: "0640"
    68     mode: "0640"
    51   loop: "{{prometheus_server_grafana_dashboards}}"
    69   loop: "{{prometheus_server_grafana_dashboards}}"
    52 
    70 
    53 # - name: install grafana dashboards
    71 - name: install grafana dashboards
    54 #   become: yes
    72   become: yes
    55 #   grafana_dashboard:
    73   grafana_dashboard:
    56 #     grafana_url: "http://localhost:3000"
    74     grafana_url: "http://localhost:3000"
    57 #     path: "/tmp/{{item}}"
    75     path: "/tmp/{{item}}"
    58 #   loop: "{{prometheus_server_grafana_dashboards}}"
    76     overwrite: yes
       
    77   loop: "{{prometheus_server_grafana_dashboards}}"