diff --git a/tasks/configure.yml b/tasks/configure.yml index 7bd2973..bd64e7b 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -29,6 +29,8 @@ - "{{ grafana_data_dir }}" - "{{ grafana_data_dir }}/dashboards" - "{{ grafana_data_dir }}/plugins" + - "{{ grafana_data_dir }}/provisioning" + - "{{ grafana_data_dir }}/provisioning/datasources" - name: Enable grafana system service systemd: diff --git a/tasks/datasources.yml b/tasks/datasources.yml index a9b75a4..e340ca4 100644 --- a/tasks/datasources.yml +++ b/tasks/datasources.yml @@ -20,3 +20,12 @@ with_items: "{{ grafana_datasources }}" no_log: True when: datasources.content == "[]" + +- name: Create datasources file + copy: + dest: "{{ grafana_data_dir }}/provisioning/datasources/ansible.yml" + content: | + delete_datasources: [] + datasources: + {{ grafana_datasources | to_nice_yaml }} + backup: no