diff --git a/tasks/main.yml b/tasks/main.yml index 880440d..f9bc735 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,8 +7,10 @@ ## prometheus server install - name: 'server install' - include_tasks: server/grafana-prometheus.yml - include_tasks: server/grafana-provisioning.yml + include_tasks: "server/{{ item }}" + loop: + - grafana-prometheus.yml + - grafana-provisioning.yml when: - prometheus_server_enable == "true" tags: diff --git a/tasks/server/grafana-provisioning.yml b/tasks/server/grafana-provisioning.yml index e5f0296..44db3ba 100644 --- a/tasks/server/grafana-provisioning.yml +++ b/tasks/server/grafana-provisioning.yml @@ -12,6 +12,19 @@ when: grafana_provisioned_datasources_path is defined notify: "grafana-prometheus-restart" +- name: "grafana-prometheus | create grafana provisioning directories" + file: + path: "/opt/docker-compose/grafana-prometheus/{{ item }}" + state: directory + owner: '1000' + group: '1000' + mode: '0755' + loop: + - datasources + - dashboards + when: grafana_provisioned_datasources_path is not defined + notify: "grafana-prometheus-restart" + - name: "grafana-prometheus | import grafana provisioned datasources conf" copy: src: dashboards/datasources.yaml