diff --git a/roles/grafana/defaults/main.yaml b/roles/grafana/defaults/main.yaml index f28d0d6..4145e6b 100644 --- a/roles/grafana/defaults/main.yaml +++ b/roles/grafana/defaults/main.yaml @@ -1,11 +1,11 @@ --- grafana_package_version: -grafana_package_name: "grafana{{grafana_package_version}}" +grafana_package_name: "grafana{{ grafana_package_version }}" grafana_package_state: present grafana_service_name: grafana-server.service grafana_service_state: started -grafana_service_enabled: yes +grafana_service_enabled: true grafana_etc_path: /etc/grafana grafana_config_path: "{{ grafana_etc_path }}/grafana.ini" @@ -23,10 +23,10 @@ grafana_config: http_addr: localhost http_port: "{{ grafana_port }}" -grafana_ssl_enabled: yes +grafana_ssl_enabled: true grafana_ssl_certificate: "/etc/letsencrypt/live/{{ grafana_domain }}/fullchain.pem" grafana_ssl_certificate_key: "/etc/letsencrypt/live/{{ grafana_domain }}/privkey.pem" -#grafana_ssl_dhparam: "/etc/letsencrypt/ssl-dhparams.pem" +# grafana_ssl_dhparam: "/etc/letsencrypt/ssl-dhparams.pem" grafana_datasources: apiVersion: 1 @@ -36,7 +36,7 @@ grafana_datasources: access: proxy url: http://localhost:8086 database: telegraf - isDefault: yes + isDefault: true version: 1 grafana_dashboards: diff --git a/roles/grafana/handlers/main.yaml b/roles/grafana/handlers/main.yaml index 70d7a08..4b63a85 100644 --- a/roles/grafana/handlers/main.yaml +++ b/roles/grafana/handlers/main.yaml @@ -1,11 +1,11 @@ --- - name: grafana daemon-reload - systemd: + ansible.builtin.systemd: name: "{{ grafana_service_name }}" - daemon_reload: yes + daemon_reload: true state: restarted - name: restart grafana - service: + ansible.builtin.service: name: "{{ grafana_service_name }}" state: restarted diff --git a/roles/grafana/tasks/Debian.yaml b/roles/grafana/tasks/Debian.yaml index ad60361..a4ab757 100644 --- a/roles/grafana/tasks/Debian.yaml +++ b/roles/grafana/tasks/Debian.yaml @@ -1,12 +1,12 @@ --- - name: add grafana apt key - apt_key: + ansible.builtin.apt_key: url: https://packages.grafana.com/gpg.key state: present - name: configure apt repository - apt_repository: + ansible.builtin.apt_repository: repo: "deb https://packages.grafana.com/oss/deb stable main" filename: grafana - update_cache: yes + update_cache: true state: present diff --git a/roles/grafana/tasks/Ubuntu-18.yaml b/roles/grafana/tasks/Ubuntu-18.yaml index d68fe2e..15a05a0 100644 --- a/roles/grafana/tasks/Ubuntu-18.yaml +++ b/roles/grafana/tasks/Ubuntu-18.yaml @@ -1,6 +1,6 @@ --- - name: create grafana-server.service.d - file: + ansible.builtin.file: path: /etc/systemd/system/grafana-server.service.d owner: root group: root @@ -8,7 +8,7 @@ state: directory - name: configure systemd override - copy: + ansible.builtin.copy: src: Ubuntu-18-override.conf dest: /etc/systemd/system/grafana-server.service.d/10-override.conf owner: root diff --git a/roles/grafana/tasks/main.yaml b/roles/grafana/tasks/main.yaml index 2672628..0a5a9ba 100644 --- a/roles/grafana/tasks/main.yaml +++ b/roles/grafana/tasks/main.yaml @@ -33,19 +33,19 @@ - tasks - name: install package - package: + ansible.builtin.package: name: "{{ grafana_package_name }}" state: "{{ grafana_package_state }}" - name: "create {{ grafana_etc_path }}" - file: + ansible.builtin.file: path: "{{ grafana_etc_path }}" owner: root group: root mode: 0755 - name: configure - template: + ansible.builtin.template: src: grafana.ini.j2 dest: "{{ grafana_config_path }}" owner: root @@ -54,7 +54,7 @@ notify: restart grafana - name: provision datasources - copy: + ansible.builtin.copy: dest: "{{ grafana_provisioning_path }}/datasources/datasource.yaml" content: "{{ grafana_datasources | to_nice_yaml }}" owner: root @@ -62,7 +62,7 @@ mode: 0640 - name: create dashboard directory - file: + ansible.builtin.file: path: /var/lib/grafana/dashboards state: directory owner: "{{ grafana_user }}" @@ -70,7 +70,7 @@ mode: 0755 - name: provision dashboards - copy: + ansible.builtin.copy: dest: "{{ grafana_provisioning_path }}/dashboards/dashboards.yaml" content: "{{ grafana_dashboards | to_nice_yaml }}" owner: root @@ -78,7 +78,7 @@ mode: 0640 - name: upload user dashboards - copy: + ansible.builtin.copy: src: "files/grafana/dashboards/{{ item }}" dest: "/var/lib/grafana/dashboards/{{ item | basename }}" owner: "{{ grafana_user }}" @@ -87,7 +87,7 @@ loop: "{{ grafana_dashboard_files | default([]) }}" - name: manage service - service: + ansible.builtin.service: name: "{{ grafana_service_name }}" state: "{{ grafana_service_state }}" enabled: "{{ grafana_service_enabled }}" diff --git a/roles/grafana/tasks/nginx.yaml b/roles/grafana/tasks/nginx.yaml index 4a79d5a..4bd4811 100644 --- a/roles/grafana/tasks/nginx.yaml +++ b/roles/grafana/tasks/nginx.yaml @@ -1,5 +1,5 @@ - name: configure nginx - template: + ansible.builtin.template: src: nginx.conf.j2 dest: "{{ nginx_conf_d_path }}/grafana.conf" owner: root