From 03db53bc65d3cc6f984535d05d50979d3fe7e624 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 19 Jan 2024 11:05:19 +0100 Subject: [PATCH] ci: ansible lint exclude tests and fix dashboard example --- .config/ansible-lint.yml | 1 + plugins/modules/grafana_dashboard.py | 69 +++++++++++++--------------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml index 403abe0d..89fde9a2 100644 --- a/.config/ansible-lint.yml +++ b/.config/ansible-lint.yml @@ -1,3 +1,4 @@ --- exclude_paths: - .github/ + - tests/ diff --git a/plugins/modules/grafana_dashboard.py b/plugins/modules/grafana_dashboard.py index 18ab041b..4fa1c6c9 100644 --- a/plugins/modules/grafana_dashboard.py +++ b/plugins/modules/grafana_dashboard.py @@ -90,42 +90,39 @@ """ EXAMPLES = """ -- hosts: localhost - connection: local - tasks: - - name: Import Grafana dashboard foo - community.grafana.grafana_dashboard: - grafana_url: http://grafana.company.com - grafana_api_key: "{{ grafana_api_key }}" - state: present - commit_message: Updated by ansible - overwrite: true - path: /path/to/dashboards/foo.json - - - name: Import Grafana dashboard Zabbix - community.grafana.grafana_dashboard: - grafana_url: http://grafana.company.com - grafana_api_key: "{{ grafana_api_key }}" - folder: zabbix - dashboard_id: 6098 - dashboard_revision: 1 - - - name: Import Grafana dashboard zabbix - community.grafana.grafana_dashboard: - grafana_url: http://grafana.company.com - grafana_api_key: "{{ grafana_api_key }}" - folder: public - dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download - - - name: Export dashboard - community.grafana.grafana_dashboard: - grafana_url: http://grafana.company.com - grafana_user: "admin" - grafana_password: "{{ grafana_password }}" - org_id: 1 - state: export - uid: "000000653" - path: "/path/to/dashboards/000000653.json" +- name: Import Grafana dashboard foo + community.grafana.grafana_dashboard: + grafana_url: http://grafana.company.com + grafana_api_key: "{{ grafana_api_key }}" + state: present + commit_message: Updated by ansible + overwrite: true + path: /path/to/dashboards/foo.json + +- name: Import Grafana dashboard Zabbix + community.grafana.grafana_dashboard: + grafana_url: http://grafana.company.com + grafana_api_key: "{{ grafana_api_key }}" + folder: zabbix + dashboard_id: 6098 + dashboard_revision: 1 + +- name: Import Grafana dashboard zabbix + community.grafana.grafana_dashboard: + grafana_url: http://grafana.company.com + grafana_api_key: "{{ grafana_api_key }}" + folder: public + dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download + +- name: Export dashboard + community.grafana.grafana_dashboard: + grafana_url: http://grafana.company.com + grafana_user: "admin" + grafana_password: "{{ grafana_password }}" + org_id: 1 + state: export + uid: "000000653" + path: "/path/to/dashboards/000000653.json" """ RETURN = """