From 86cb52265a84525aa1358095cbe4224e44284cb8 Mon Sep 17 00:00:00 2001 From: John R Barker Date: Mon, 23 Oct 2023 12:43:08 +0100 Subject: [PATCH 01/32] CODEOWNERS: Reduce review requirements You folks know what you are doing, you don't need my reviews. --- .github/CODEOWNERS | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3035cfbb..2cc40362 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,13 +1,9 @@ .github # Repo maintainers, and goverance team (like Anisble's @ansible-commit-external) -* @rrey @seuf @gundalow-collections/community-goverance-team +* @rrey @seuf # or possibly, we may want to define teams at the org level. -# * @gundalow-collections/grafana-maintainers # Example of maintainer of just a single plugin #grafana/plugins/modules/grafana_plugin.py @someone-else - - -.github/ @gundalow From f5f65d0a6aa829527ca59fd5c4b5ea773bd1a3e8 Mon Sep 17 00:00:00 2001 From: Hiromasa Ihara Date: Sat, 19 Aug 2023 16:55:58 +0900 Subject: [PATCH 02/32] Bump requests from 2.28.2 to 2.31.0 --- hacking/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hacking/requirements.txt b/hacking/requirements.txt index ced51d09..2c24336e 100644 --- a/hacking/requirements.txt +++ b/hacking/requirements.txt @@ -1 +1 @@ -requests==2.28.0 +requests==2.31.0 From 9471c98315063d4d14516fcfb11eda38c58f8a87 Mon Sep 17 00:00:00 2001 From: rrey Date: Sun, 29 Oct 2023 01:26:27 +0000 Subject: [PATCH 03/32] Update tested Grafana versions --- .github/workflows/ansible-test.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index e8f2cd6b..65b0443e 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - grafana_version: ["9.2.6", "8.5.15", "7.5.16"] + grafana_version: ["9.5.13", "8.5.27", "10.2.0"] ansible_version: ["stable-2.13", "stable-2.14", "devel"] python_version: ["3.9"] services: diff --git a/README.md b/README.md index c2e7eb65..1d4ddb2c 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Click on the name of a plugin or module to view that content's documentation: We aim at keeping the last 3 Major versions of Grafana tested. This collection is currently testing the modules against following versions of Grafana: ``` -grafana_version: ["9.2.6", "8.5.15", "7.5.16"] +grafana_version: ["9.5.13", "8.5.27", "10.2.0"] ``` ## Installation and Usage From fdd5e6ee506d94e37d95bdf08c52a31ee1e48450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sat, 4 Nov 2023 18:53:37 +0100 Subject: [PATCH 04/32] Bump Python version to 3.10 for tests --- .github/workflows/ansible-test.yml | 6 +++--- changelogs/fragments/294-bump-grafana-version.yml | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/294-bump-grafana-version.yml diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 65b0443e..fff19d23 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -12,7 +12,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - python_version: ["3.9"] + python_version: ["3.10"] ansible_version: ["stable-2.13", "stable-2.14", "devel"] steps: - name: Perform testing @@ -29,7 +29,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - python_version: ["3.9"] + python_version: ["3.10"] ansible_version: ["stable-2.13", "stable-2.14", "devel"] steps: - name: Perform testing @@ -47,7 +47,7 @@ jobs: matrix: grafana_version: ["9.5.13", "8.5.27", "10.2.0"] ansible_version: ["stable-2.13", "stable-2.14", "devel"] - python_version: ["3.9"] + python_version: ["3.10"] services: grafana: image: grafana/grafana:${{ matrix.grafana_version }} diff --git a/changelogs/fragments/294-bump-grafana-version.yml b/changelogs/fragments/294-bump-grafana-version.yml new file mode 100644 index 00000000..f171f15c --- /dev/null +++ b/changelogs/fragments/294-bump-grafana-version.yml @@ -0,0 +1,2 @@ +minor_changes: + - Bump version of Python used in tests to 3.10 From aca73d92f793598b4283f4b8bfd011d25a68b83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sat, 4 Nov 2023 20:23:11 +0100 Subject: [PATCH 05/32] fix(folders): make sure to return a json response if Grafana returns an empty response Since Grafana 9.3 the folders endpoint stopped sending back json in response breaking the module response handling. See https://github.com/grafana/grafana/issues/77673 --- changelogs/fragments/294-bump-grafana-version.yml | 2 ++ plugins/modules/grafana_folder.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelogs/fragments/294-bump-grafana-version.yml b/changelogs/fragments/294-bump-grafana-version.yml index f171f15c..a3050c01 100644 --- a/changelogs/fragments/294-bump-grafana-version.yml +++ b/changelogs/fragments/294-bump-grafana-version.yml @@ -1,2 +1,4 @@ minor_changes: - Bump version of Python used in tests to 3.10 +bugfixes: + - grafana_folder, fix an issue during delete (starting Grafana 9.3) diff --git a/plugins/modules/grafana_folder.py b/plugins/modules/grafana_folder.py index d39e56e4..380a510c 100644 --- a/plugins/modules/grafana_folder.py +++ b/plugins/modules/grafana_folder.py @@ -215,7 +215,10 @@ def _send_request(self, url, data=None, headers=None, method="GET"): error_msg = resp.read()['message'] self._module.fail_json(failed=True, msg=error_msg) elif status_code == 200: - return self._module.from_json(resp.read()) + # XXX: Grafana folders endpoint stopped sending back json in response for delete operations + # see https://github.com/grafana/grafana/issues/77673 + response = resp.read() or "{}" + return self._module.from_json(response) self._module.fail_json(failed=True, msg="Grafana Folders API answered with HTTP %d" % status_code) def get_version(self): From 3d55a3b69490e3b73cd70c2374e5c8b2e1efbcd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sat, 4 Nov 2023 22:07:49 +0100 Subject: [PATCH 06/32] fix(syntax): replace include by include_tasks It was removed from ansible-core in a release after 2023-05-16 --- .../targets/grafana_dashboard/tasks/main.yml | 12 +++---- .../targets/grafana_datasource/tasks/main.yml | 22 ++++++------ .../tasks/main.yml | 36 +++++++++---------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/integration/targets/grafana_dashboard/tasks/main.yml b/tests/integration/targets/grafana_dashboard/tasks/main.yml index 4d9138fc..570fb4d8 100644 --- a/tests/integration/targets/grafana_dashboard/tasks/main.yml +++ b/tests/integration/targets/grafana_dashboard/tasks/main.yml @@ -1,7 +1,7 @@ - block: - - include: dashboard-from-url.yml - - include: delete-dashboard.yml - - include: dashboard-from-id.yml - - include: dashboard-from-file.yml - - include: dashboard-export.yml - - include: dashboard-folder-destination.yml + - include_tasks: dashboard-from-url.yml + - include_tasks: delete-dashboard.yml + - include_tasks: dashboard-from-id.yml + - include_tasks: dashboard-from-file.yml + - include_tasks: dashboard-export.yml + - include_tasks: dashboard-folder-destination.yml diff --git a/tests/integration/targets/grafana_datasource/tasks/main.yml b/tests/integration/targets/grafana_datasource/tasks/main.yml index b5798e9a..312ad347 100644 --- a/tests/integration/targets/grafana_datasource/tasks/main.yml +++ b/tests/integration/targets/grafana_datasource/tasks/main.yml @@ -1,16 +1,16 @@ --- - block: - - include: errors.yml - - include: elastic.yml - - include: influx.yml - - include: postgres.yml - - include: cloudwatch.yml - - include: thruk.yml - - include: loki.yml - - include: zabbix.yml - - include: redis.yml - - include: azure.yml - - include: uid.yml + - include_tasks: errors.yml + - include_tasks: elastic.yml + - include_tasks: influx.yml + - include_tasks: postgres.yml + - include_tasks: cloudwatch.yml + - include_tasks: thruk.yml + - include_tasks: loki.yml + - include_tasks: zabbix.yml + - include_tasks: redis.yml + - include_tasks: azure.yml + - include_tasks: uid.yml ... diff --git a/tests/integration/targets/grafana_notification_channel/tasks/main.yml b/tests/integration/targets/grafana_notification_channel/tasks/main.yml index ada6338c..ceaf72ad 100644 --- a/tests/integration/targets/grafana_notification_channel/tasks/main.yml +++ b/tests/integration/targets/grafana_notification_channel/tasks/main.yml @@ -1,20 +1,20 @@ --- - block: - - include: dingding.yml - - include: discord.yml - - include: email.yml - - include: googlechat.yml - - include: hipchat.yml - - include: kafka.yml -# - include: line.yml - - include: teams.yml - - include: opsgenie.yml - - include: pagerduty.yml - - include: prometheus.yml - - include: pushover.yml - - include: sensu.yml - - include: slack-and-beyond.yml - - include: telegram.yml -# - include: threema.yml - - include: victorops.yml - - include: webhook.yml + - include_tasks: dingding.yml + - include_tasks: discord.yml + - include_tasks: email.yml + - include_tasks: googlechat.yml + - include_tasks: hipchat.yml + - include_tasks: kafka.yml +# - include_tasks: line.yml + - include_tasks: teams.yml + - include_tasks: opsgenie.yml + - include_tasks: pagerduty.yml + - include_tasks: prometheus.yml + - include_tasks: pushover.yml + - include_tasks: sensu.yml + - include_tasks: slack-and-beyond.yml + - include_tasks: telegram.yml +# - include_tasks: threema.yml + - include_tasks: victorops.yml + - include_tasks: webhook.yml From 4e0195eb58358ee426849bcad315a165d5ec4fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sat, 4 Nov 2023 22:17:50 +0100 Subject: [PATCH 07/32] test(sanity): create the ignore file for devel --- changelogs/fragments/294-bump-grafana-version.yml | 1 + plugins/modules/grafana_datasource.py | 7 +++++-- tests/sanity/ignore-2.16.txt | 4 ++++ tests/sanity/ignore-2.17.txt | 4 ++++ .../grafana/grafana_datasource/test_grafana_datasource.py | 2 +- .../unit/modules/grafana/grafana_team/test_grafana_team.py | 2 +- .../unit/modules/grafana/grafana_user/test_grafana_user.py | 2 +- 7 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 tests/sanity/ignore-2.16.txt create mode 100644 tests/sanity/ignore-2.17.txt diff --git a/changelogs/fragments/294-bump-grafana-version.yml b/changelogs/fragments/294-bump-grafana-version.yml index a3050c01..7149cfe0 100644 --- a/changelogs/fragments/294-bump-grafana-version.yml +++ b/changelogs/fragments/294-bump-grafana-version.yml @@ -1,4 +1,5 @@ minor_changes: - Bump version of Python used in tests to 3.10 + - Now testing against Grafana 9.5.13, 8.5.27, 10.2.0 bugfixes: - grafana_folder, fix an issue during delete (starting Grafana 9.3) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index 154dc451..b0496a97 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -67,15 +67,18 @@ (index name), C(mysql) or C(postgres). required: false type: str + default: '' user: description: - The datasource login user for influxdb datasources. type: str + default: '' password: description: - The datasource password. - Stored as secure data, see C(enforce_secure_data) and notes! type: str + default: '' basic_auth_user: description: - The datasource basic auth user. @@ -180,6 +183,7 @@ - Monthly - Yearly type: str + default: '' tsdb_version: description: - The opentsdb version. @@ -280,7 +284,6 @@ aws_custom_metrics_namespaces: description: - Namespaces of Custom Metrics for CloudWatch datasource type - default: '' required: false type: str azure_cloud: @@ -494,7 +497,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six.moves.urllib.parse import quote -from ansible.module_utils.urls import fetch_url, url_argument_spec, basic_auth_header +from ansible.module_utils.urls import fetch_url, basic_auth_header from ansible_collections.community.grafana.plugins.module_utils import base diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt new file mode 100644 index 00000000..5c82494f --- /dev/null +++ b/tests/sanity/ignore-2.16.txt @@ -0,0 +1,4 @@ +plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name +tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291 +hacking/check_fragment.sh shebang +hacking/find_grafana_versions.py shebang diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt new file mode 100644 index 00000000..5c82494f --- /dev/null +++ b/tests/sanity/ignore-2.17.txt @@ -0,0 +1,4 @@ +plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name +tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291 +hacking/check_fragment.sh shebang +hacking/find_grafana_versions.py shebang diff --git a/tests/unit/modules/grafana/grafana_datasource/test_grafana_datasource.py b/tests/unit/modules/grafana/grafana_datasource/test_grafana_datasource.py index d2fba0fe..0a68fda7 100644 --- a/tests/unit/modules/grafana/grafana_datasource/test_grafana_datasource.py +++ b/tests/unit/modules/grafana/grafana_datasource/test_grafana_datasource.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function) from unittest import TestCase -from unittest.mock import call, patch, MagicMock +from unittest.mock import patch from ansible_collections.community.grafana.plugins.modules import grafana_datasource from ansible.module_utils._text import to_bytes from ansible.module_utils import basic diff --git a/tests/unit/modules/grafana/grafana_team/test_grafana_team.py b/tests/unit/modules/grafana/grafana_team/test_grafana_team.py index c59953af..491b863d 100644 --- a/tests/unit/modules/grafana/grafana_team/test_grafana_team.py +++ b/tests/unit/modules/grafana/grafana_team/test_grafana_team.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function) from unittest import TestCase -from unittest.mock import patch, MagicMock +from unittest.mock import patch from ansible_collections.community.grafana.plugins.modules import grafana_team from ansible.module_utils._text import to_bytes from ansible.module_utils import basic diff --git a/tests/unit/modules/grafana/grafana_user/test_grafana_user.py b/tests/unit/modules/grafana/grafana_user/test_grafana_user.py index 925c0165..80c51409 100644 --- a/tests/unit/modules/grafana/grafana_user/test_grafana_user.py +++ b/tests/unit/modules/grafana/grafana_user/test_grafana_user.py @@ -1,7 +1,7 @@ from __future__ import (absolute_import, division, print_function) from unittest import TestCase -from unittest.mock import call, patch, MagicMock +from unittest.mock import call, patch from ansible_collections.community.grafana.plugins.modules import grafana_user from ansible.module_utils._text import to_bytes from ansible.module_utils import basic From 7682b9504995f2ade148861e0c11df252cb38796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sun, 11 Dec 2022 16:38:07 +0100 Subject: [PATCH 08/32] docs(galaxy): fix url for docs.ansible.com --- changelogs/fragments/285_fix_doc.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelogs/fragments/285_fix_doc.yml diff --git a/changelogs/fragments/285_fix_doc.yml b/changelogs/fragments/285_fix_doc.yml new file mode 100644 index 00000000..5096495e --- /dev/null +++ b/changelogs/fragments/285_fix_doc.yml @@ -0,0 +1,6 @@ +--- + +minor: + - Fix documentation url for Ansible doc website + +... From edc6c2d50edfe3c7dfead84c54fb86e7da3a0af8 Mon Sep 17 00:00:00 2001 From: Marcin Mielnicki <1526000+platan@users.noreply.github.com> Date: Sun, 1 Oct 2023 09:44:17 +0200 Subject: [PATCH 09/32] Fix typo in grafana_dashboard module documentation --- plugins/modules/grafana_dashboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/grafana_dashboard.py b/plugins/modules/grafana_dashboard.py index 99801d49..cc2654f6 100644 --- a/plugins/modules/grafana_dashboard.py +++ b/plugins/modules/grafana_dashboard.py @@ -101,7 +101,7 @@ grafana_api_key: "{{ grafana_api_key }}" folder: zabbix dashboard_id: 6098 - dashbord_revision: 1 + dashboard_revision: 1 - name: Import Grafana dashboard zabbix community.grafana.grafana_dashboard: From 7ab900f2ff0299a2fc6a68041d51b1106973e5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sun, 5 Nov 2023 00:51:23 +0100 Subject: [PATCH 10/32] fix(changelog): fix the keyword in a contributor changelog --- changelogs/fragments/285_fix_doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/285_fix_doc.yml b/changelogs/fragments/285_fix_doc.yml index 5096495e..74db5e2c 100644 --- a/changelogs/fragments/285_fix_doc.yml +++ b/changelogs/fragments/285_fix_doc.yml @@ -1,6 +1,6 @@ --- -minor: +minor_changes: - Fix documentation url for Ansible doc website ... From 297b585724d54885de36175ea3d03ba1775c1e87 Mon Sep 17 00:00:00 2001 From: Alexander Kasper Date: Thu, 12 Oct 2023 20:54:22 +0200 Subject: [PATCH 11/32] chg: only remove basicAuthUser from datasource if it is present If there is no check for its presence, this will fail if a datasource is not configured with basic auth at all. In that case it would try to remove an entry from the dict that is not there resulting in a KeyError. --- plugins/modules/grafana_datasource.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index b0496a97..95faca2f 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -519,7 +519,8 @@ def compare_datasources(new, current, compareSecureData=True): if 'readOnly' in current: del current['readOnly'] if current['basicAuth'] is False: - del current['basicAuthUser'] + if 'basicAuthUser' in current: + del current['basicAuthUser'] if 'password' in current: del current['password'] if 'basicAuthPassword' in current: From 9c818adcbd5d3104fbe8acc0cef07e6379d093e1 Mon Sep 17 00:00:00 2001 From: Alexander Kasper Date: Thu, 26 Oct 2023 07:57:10 +0200 Subject: [PATCH 12/32] add changelog fragment --- changelogs/fragments/fix-316.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/fix-316.yml diff --git a/changelogs/fragments/fix-316.yml b/changelogs/fragments/fix-316.yml new file mode 100644 index 00000000..4569d445 --- /dev/null +++ b/changelogs/fragments/fix-316.yml @@ -0,0 +1,2 @@ +bugfixes: + - Fix error with datasources configured without basicAuth \ No newline at end of file From b2efe0a20c3da442d146c7a3f6e591603390038e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sun, 5 Nov 2023 00:46:17 +0100 Subject: [PATCH 13/32] Update plugins/modules/grafana_datasource.py fix indent --- plugins/modules/grafana_datasource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index 95faca2f..5f865ec5 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -520,7 +520,7 @@ def compare_datasources(new, current, compareSecureData=True): del current['readOnly'] if current['basicAuth'] is False: if 'basicAuthUser' in current: - del current['basicAuthUser'] + del current['basicAuthUser'] if 'password' in current: del current['password'] if 'basicAuthPassword' in current: From 0ae8c31f4662e389da53e02531426d5c27286101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20REY?= Date: Sun, 5 Nov 2023 01:06:14 +0100 Subject: [PATCH 14/32] build(1.6.1): release version --- CHANGELOG.rst | 17 +++++++++++++++++ changelogs/changelog.yaml | 16 ++++++++++++++++ galaxy.yml | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9181c9b9..5385a3f3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,23 @@ Grafana Collection Release Notes .. contents:: Topics +v1.6.1 +====== + +Minor Changes +------------- + +- Bump version of Python used in tests to 3.10 +- Enable datasource option `time_interval` for prometheus +- Fix documentation url for Ansible doc website +- Now testing against Grafana 9.5.13, 8.5.27, 10.2.0 + +Bugfixes +-------- + +- Fix error with datasources configured without basicAuth +- grafana_folder, fix an issue during delete (starting Grafana 9.3) + v1.6.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 0c670bbc..0f1f2932 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -218,3 +218,19 @@ releases: name: grafana_organization_user namespace: '' release_date: '2023-02-19' + 1.6.1: + changes: + bugfixes: + - Fix error with datasources configured without basicAuth + - grafana_folder, fix an issue during delete (starting Grafana 9.3) + minor_changes: + - Bump version of Python used in tests to 3.10 + - Enable datasource option `time_interval` for prometheus + - Fix documentation url for Ansible doc website + - Now testing against Grafana 9.5.13, 8.5.27, 10.2.0 + fragments: + - 285_fix_doc.yml + - 294-bump-grafana-version.yml + - 300_datasource_prometheus_time_interval.yml + - fix-316.yml + release_date: '2023-11-05' diff --git a/galaxy.yml b/galaxy.yml index 8b482377..739c4c33 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,6 +1,6 @@ namespace: community name: grafana -version: 1.6.0 +version: 1.6.1 readme: README.md authors: - Rémi REY (@rrey) From 0737162cde6c3c3ccf533e60b78247ed75128a06 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:10:15 +0100 Subject: [PATCH 15/32] docs: added org_name --- plugins/modules/grafana_organization_user.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/modules/grafana_organization_user.py b/plugins/modules/grafana_organization_user.py index 72496b84..7d82e962 100644 --- a/plugins/modules/grafana_organization_user.py +++ b/plugins/modules/grafana_organization_user.py @@ -57,6 +57,12 @@ default: 1 description: - Organization ID. + - Mutually exclusive with `org_name`. + org_name: + type: str + description: + - Organization name. + - Mutually exclusive with `org_id`. extends_documentation_fragment: - community.grafana.basic_auth From 11db520c9a26666481a9dd6b0696274585cc1b13 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:29:56 +0100 Subject: [PATCH 16/32] feat: init get org id by org name --- plugins/modules/grafana_organization_user.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/modules/grafana_organization_user.py b/plugins/modules/grafana_organization_user.py index 7d82e962..db3db75f 100644 --- a/plugins/modules/grafana_organization_user.py +++ b/plugins/modules/grafana_organization_user.py @@ -162,6 +162,12 @@ def _api_call(self, method, path, payload): data = json.dumps(payload) return fetch_url(self._module, self.grafana_url + '/api/' + path, headers=self.headers, method=method, data=data) + def _organization_by_name(self, org_name): + r, info = self._api_call('GET', 'orgs/name/%s' % org_name, None) + if info['status'] != 200: + raise GrafanaAPIException("Unable to retrieve organization: %s" % info) + return json.loads(to_text(r.read())) + def _organization_users(self, org_id): r, info = self._api_call('GET', 'orgs/%d/users' % org_id, None) if info['status'] != 200: @@ -238,12 +244,16 @@ def main(): argument_spec.pop('grafana_api_key') argument_spec.update( org_id=dict(type='int', default=1), + org_name=dict(type='str', required=False), login=dict(type='str', required=True), role=dict(type='str', choices=['viewer', 'editor', 'admin'], default='viewer'), ) module = AnsibleModule( argument_spec=argument_spec, supports_check_mode=False, + mutually_exclusive=[ + ('org_id', 'org_name'), + ], required_if=[ ['state', 'present', ['role']], ] @@ -252,6 +262,10 @@ def main(): org_id = module.params['org_id'] login = module.params['login'] iface = GrafanaOrganizationUserInterface(module) + if module.params['org_name']: + org_name = module.params['org_name'] + result = iface._organization_by_name(org_name) + module.exit_json(failed=False, **result) if module.params['state'] == 'present': role = module.params['role'].capitalize() result = iface.create_or_update_user(org_id, login, role) From f575413236e387228079e5f3cb8fce1b5bf429e7 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:00:07 +0100 Subject: [PATCH 17/32] fix: get orga users by login --- plugins/modules/grafana_organization_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/grafana_organization_user.py b/plugins/modules/grafana_organization_user.py index db3db75f..11b93def 100644 --- a/plugins/modules/grafana_organization_user.py +++ b/plugins/modules/grafana_organization_user.py @@ -190,7 +190,7 @@ def _remove_organization_user(self, org_id, user_id): def _organization_user_by_login(self, org_id, login): for user in self._organization_users(org_id): - if user['name'] == login or user['email'] == login: + if login in (user['login'], user['email']): return user def create_or_update_user(self, org_id, login, role): From 85c1441be41013aedce73a27c76ee4d348a3a6bb Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:15:01 +0100 Subject: [PATCH 18/32] fix: set org_id for further use --- plugins/modules/grafana_organization_user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/grafana_organization_user.py b/plugins/modules/grafana_organization_user.py index 11b93def..d0f85d1c 100644 --- a/plugins/modules/grafana_organization_user.py +++ b/plugins/modules/grafana_organization_user.py @@ -264,8 +264,8 @@ def main(): iface = GrafanaOrganizationUserInterface(module) if module.params['org_name']: org_name = module.params['org_name'] - result = iface._organization_by_name(org_name) - module.exit_json(failed=False, **result) + organization = iface._organization_by_name(org_name) + org_id = organization['id'] if module.params['state'] == 'present': role = module.params['role'].capitalize() result = iface.create_or_update_user(org_id, login, role) From 0fd9324ffb2c0654f293777c55beaba02215dee6 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:30:29 +0100 Subject: [PATCH 19/32] chore: required is default false --- plugins/modules/grafana_organization_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/grafana_organization_user.py b/plugins/modules/grafana_organization_user.py index d0f85d1c..14195fdb 100644 --- a/plugins/modules/grafana_organization_user.py +++ b/plugins/modules/grafana_organization_user.py @@ -244,7 +244,7 @@ def main(): argument_spec.pop('grafana_api_key') argument_spec.update( org_id=dict(type='int', default=1), - org_name=dict(type='str', required=False), + org_name=dict(type='str'), login=dict(type='str', required=True), role=dict(type='str', choices=['viewer', 'editor', 'admin'], default='viewer'), ) From 165132497c53e535502039a722d5ff032cf29ee5 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Sun, 5 Nov 2023 22:07:42 +0100 Subject: [PATCH 20/32] docs: added fragment --- changelogs/fragments/318-org_users_by_org_name.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/318-org_users_by_org_name.yml diff --git a/changelogs/fragments/318-org_users_by_org_name.yml b/changelogs/fragments/318-org_users_by_org_name.yml new file mode 100644 index 00000000..d7f59c64 --- /dev/null +++ b/changelogs/fragments/318-org_users_by_org_name.yml @@ -0,0 +1,4 @@ +--- + +minor_changes: + - Add parameter `org_name` to `grafana_organization_user` From 709397ec1716f3973474fcc7f645f312b8162a2d Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:24:50 +0100 Subject: [PATCH 21/32] test: added tests with org_name --- .../grafana_organization_user/tasks/main.yml | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/grafana_organization_user/tasks/main.yml b/tests/integration/targets/grafana_organization_user/tasks/main.yml index 6ac1f131..3ede4f7c 100644 --- a/tests/integration/targets/grafana_organization_user/tasks/main.yml +++ b/tests/integration/targets/grafana_organization_user/tasks/main.yml @@ -92,7 +92,7 @@ state: present register: org -- name: Add user to the organization +- name: Add user to the new organization by org_id community.grafana.grafana_organization_user: url: "{{ grafana_url }}" url_username: "{{ grafana_username }}" @@ -108,3 +108,48 @@ - "result.changed == true" - "result.user.orgId == org.org.id" - "result.user.role == 'Admin'" + +- name: Remove user from new organization by org_id + community.grafana.grafana_organization_user: + url: "{{ grafana_url }}" + url_username: "{{ grafana_username }}" + url_password: "{{ grafana_password }}" + org_id: "{{ org.org.id }}" + login: orgtest + state: absent + register: result +- assert: + that: + - "result.failed == false" + - "result.changed == true" + +- name: Add user to the new organization by org_name + community.grafana.grafana_organization_user: + url: "{{ grafana_url }}" + url_username: "{{ grafana_username }}" + url_password: "{{ grafana_password }}" + org_name: "{{ org.org.name }}" + login: orgtest + role: admin + state: present + register: result +- assert: + that: + - "result.failed == false" + - "result.changed == true" + - "result.user.orgId == org.org.id" + - "result.user.role == 'Admin'" + +- name: Remove user from new organization by org_name + community.grafana.grafana_organization_user: + url: "{{ grafana_url }}" + url_username: "{{ grafana_username }}" + url_password: "{{ grafana_password }}" + org_name: "{{ org.org.name }}" + login: orgtest + state: absent + register: result +- assert: + that: + - "result.failed == false" + - "result.changed == true" From 5acf956b6fba959cdcbd3ef230a316f53f2b723b Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:59:30 +0100 Subject: [PATCH 22/32] docs: mentioned test in fragment --- changelogs/fragments/318-org_users_by_org_name.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelogs/fragments/318-org_users_by_org_name.yml b/changelogs/fragments/318-org_users_by_org_name.yml index d7f59c64..ef8d4959 100644 --- a/changelogs/fragments/318-org_users_by_org_name.yml +++ b/changelogs/fragments/318-org_users_by_org_name.yml @@ -2,3 +2,6 @@ minor_changes: - Add parameter `org_name` to `grafana_organization_user` + +trivial: + - Add tests for new `grafana_organization_user`-parameter `org_name` From a5923a14b10c063ffa1444fa78348bba62aa0c9d Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:32:07 +0100 Subject: [PATCH 23/32] fix: add org users module and indent --- meta/runtime.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/meta/runtime.yml b/meta/runtime.yml index 8d9b13a4..ed9ac426 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -2,11 +2,12 @@ requires_ansible: '>=2.9.0' action_groups: grafana: - - grafana_dashboard - - grafana_datasource - - grafana_folder - - grafana_notification_channel - - grafana_organization - - grafana_plugin - - grafana_team - - grafana_user + - grafana_dashboard + - grafana_datasource + - grafana_folder + - grafana_notification_channel + - grafana_organization + - grafana_organization_user + - grafana_plugin + - grafana_team + - grafana_user From ff49e951e5656ce3298fd7e958fb9845add59193 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:40:44 +0100 Subject: [PATCH 24/32] docs: added changelog fragment --- changelogs/fragments/321-action-groups-org-users.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/321-action-groups-org-users.yml diff --git a/changelogs/fragments/321-action-groups-org-users.yml b/changelogs/fragments/321-action-groups-org-users.yml new file mode 100644 index 00000000..d62f076b --- /dev/null +++ b/changelogs/fragments/321-action-groups-org-users.yml @@ -0,0 +1,4 @@ +--- + +bugfixes: + - Add `grafana_organiazion_user` to `action_groups.grafana` From 7f056829debba911396d4eb659839195bad8afd4 Mon Sep 17 00:00:00 2001 From: rrey Date: Sun, 26 Nov 2023 01:28:27 +0000 Subject: [PATCH 25/32] Update tested Grafana versions --- .github/workflows/ansible-test.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index fff19d23..85fbc432 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - grafana_version: ["9.5.13", "8.5.27", "10.2.0"] + grafana_version: ["9.5.14", "8.5.27", "10.2.2"] ansible_version: ["stable-2.13", "stable-2.14", "devel"] python_version: ["3.10"] services: diff --git a/README.md b/README.md index 1d4ddb2c..cfdfbc98 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Click on the name of a plugin or module to view that content's documentation: We aim at keeping the last 3 Major versions of Grafana tested. This collection is currently testing the modules against following versions of Grafana: ``` -grafana_version: ["9.5.13", "8.5.27", "10.2.0"] +grafana_version: ["9.5.14", "8.5.27", "10.2.2"] ``` ## Installation and Usage From 05271d8edb1b2de095b172d20dae0d42c36b9b9c Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:31:40 +0100 Subject: [PATCH 26/32] docs: added telekom-mms.grafana section --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cfdfbc98..9b601a44 100644 --- a/README.md +++ b/README.md @@ -67,12 +67,9 @@ You can either call modules by their Fully Qualified Collection Namespace (FQCN) gather_facts: false connection: local - collections: - - community.grafana - tasks: - name: Ensure Influxdb datasource exists. - grafana_datasource: + community.grafana.grafana_datasource: name: "datasource-influxdb" grafana_url: "https://grafana.company.com" grafana_user: "admin" @@ -93,13 +90,11 @@ In your playbooks, you can set [module defaults](https://github.com/ansible/ansi ```yaml +--- - hosts: localhost gather_facts: false connection: local - collections: - - community.grafana - module_defaults: group/community.grafana.grafana: grafana_url: "https://grafana.company.com" @@ -108,7 +103,7 @@ In your playbooks, you can set [module defaults](https://github.com/ansible/ansi tasks: - name: Ensure Influxdb datasource exists. - grafana_datasource: + community.grafana.grafana_datasource: name: "datasource-influxdb" org_id: "1" ds_type: "influxdb" @@ -118,7 +113,7 @@ In your playbooks, you can set [module defaults](https://github.com/ansible/ansi tls_ca_cert: "/etc/ssl/certs/ca.pem" - name: Create or update a Grafana user - grafana_user: + community.grafana.grafana_user: name: "Bruce Wayne" email: "batman@gotham.city" login: "batman" @@ -126,6 +121,45 @@ In your playbooks, you can set [module defaults](https://github.com/ansible/ansi is_admin: true ``` +## Complementary Collection: [`telekom-mms.grafana`](https://github.com/telekom-mms/ansible-role-grafana) + +The `telekom-mms.grafana` collection is an Ansible Collection that simplifies the use of the `community.grafana` collection. It provides an Ansible Role for easy integration with `community.grafana`. With this collection, you only need to define the variables for your Grafana resources. + +### Requirements + ansible-galaxy collection install telekom-mms.grafana +... or use a requirements.yml: +`ansible-galaxy collection install -r requirements.yml` +```yaml +--- +collections: + - name: telekom-mms.grafana +``` + +### Example Playbook +```yaml +--- +- hosts: localhost + gather_facts: false + connection: local + + vars: + grafana_url: "https://grafana.company.com" + grafana_user: "admin" + grafana_password: "xxxxxx" + + grafana_datasources: + - name: "Loki" + ds_type: "loki" + ds_url: "http://127.0.0.1:3100" + tls_skip_verify: yes + grafana_folders: + - name: my_service + - name: other_service + + roles: + - role: telekom-mms.grafana +``` + ## Testing and Development If you want to develop new content for this collection or improve what's already here, the easiest way to work on the collection is to clone it into one of the configured [`COLLECTIONS_PATHS`](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#collections-paths), and work on it there. From d123cd7525b462e0cf66ad02cc2450b31b114619 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:44:36 +0000 Subject: [PATCH 27/32] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b601a44..3334529f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![](https://github.com/ansible-collections/grafana/workflows/CI/badge.svg?branch=master) [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.grafana)](https://codecov.io/gh/ansible-collections/community.grafana) -[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors-) This repo hosts the `community.grafana` Ansible Collection. @@ -253,6 +253,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Pierre
Pierre

🐛 MiksonX
MiksonX

🐛 Aliaksandr Mianzhynski
Aliaksandr Mianzhynski

💻 ⚠️ + Moritz
Moritz

🐛 From 7c8f520c4e61fbe115c417bb43239c613cee136c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:44:37 +0000 Subject: [PATCH 28/32] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index b7e51435..2c7b593a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -187,6 +187,15 @@ "code", "test" ] + }, + { + "login": "Nemental", + "name": "Moritz", + "avatar_url": "https://avatars.githubusercontent.com/u/15136847?v=4", + "profile": "https://nemental.de", + "contributions": [ + "bug" + ] } ], "contributorsPerLine": 7, @@ -195,5 +204,6 @@ "repoType": "github", "repoHost": "https://github.com", "skipCi": true, - "commitConvention": "angular" + "commitConvention": "angular", + "commitType": "docs" } From cd53136f8be51e639a78baab2a6cd54bbd8e262c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:48:29 +0000 Subject: [PATCH 29/32] docs: update README.md [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3334529f..ce32c493 100644 --- a/README.md +++ b/README.md @@ -253,7 +253,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Pierre
Pierre

🐛 MiksonX
MiksonX

🐛 Aliaksandr Mianzhynski
Aliaksandr Mianzhynski

💻 ⚠️ - Moritz
Moritz

🐛 + Moritz
Moritz

🐛 💻 From 21b6f4101e96247da04c61124c319a0740258a1b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:48:30 +0000 Subject: [PATCH 30/32] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 2c7b593a..f1a1cb6d 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -194,7 +194,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/15136847?v=4", "profile": "https://nemental.de", "contributions": [ - "bug" + "bug", + "code" ] } ], From 0100a21a4f537a381cdd5400ec810d57eb9059d9 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Mon, 13 Nov 2023 16:40:52 +0100 Subject: [PATCH 31/32] default to true/false --- plugins/callback/grafana_annotations.py | 4 ++-- plugins/doc_fragments/basic_auth.py | 10 +++++----- plugins/modules/grafana_dashboard.py | 4 ++-- plugins/modules/grafana_datasource.py | 8 ++++---- plugins/modules/grafana_folder.py | 2 +- plugins/modules/grafana_notification_channel.py | 6 +++--- plugins/modules/grafana_plugin.py | 2 +- plugins/modules/grafana_team.py | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/plugins/callback/grafana_annotations.py b/plugins/callback/grafana_annotations.py index 04555eae..92b837c1 100644 --- a/plugins/callback/grafana_annotations.py +++ b/plugins/callback/grafana_annotations.py @@ -29,7 +29,7 @@ options: grafana_url: description: Grafana annotations api URL - required: True + required: true env: - name: GRAFANA_URL ini: @@ -45,7 +45,7 @@ key: validate_grafana_certs - section: callback_grafana_annotations key: validate_certs - default: True + default: true type: bool aliases: [ validate_grafana_certs ] http_agent: diff --git a/plugins/doc_fragments/basic_auth.py b/plugins/doc_fragments/basic_auth.py index 8c41acdb..c874457d 100644 --- a/plugins/doc_fragments/basic_auth.py +++ b/plugins/doc_fragments/basic_auth.py @@ -30,9 +30,9 @@ class ModuleDocFragment(object): aliases: [ grafana_password ] use_proxy: description: - - If C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts. + - If C(false), it will not use a proxy, even if one is defined in an environment variable on the target hosts. type: bool - default: yes + default: true client_cert: description: - PEM formatted certificate chain file to be used for SSL client authentication. @@ -45,8 +45,8 @@ class ModuleDocFragment(object): type: path validate_certs: description: - - If C(no), SSL certificates will not be validated. - - This should only set to C(no) used on personally controlled sites using self-signed certificates. + - If C(false), SSL certificates will not be validated. + - This should only set to C(false) used on personally controlled sites using self-signed certificates. type: bool - default: yes + default: true ''' diff --git a/plugins/modules/grafana_dashboard.py b/plugins/modules/grafana_dashboard.py index cc2654f6..46d3aeb1 100644 --- a/plugins/modules/grafana_dashboard.py +++ b/plugins/modules/grafana_dashboard.py @@ -58,7 +58,7 @@ description: - Override existing dashboard when state is present. type: bool - default: 'no' + default: false dashboard_id: description: - Public Grafana.com dashboard id to import @@ -92,7 +92,7 @@ grafana_api_key: "{{ grafana_api_key }}" state: present commit_message: Updated by ansible - overwrite: yes + overwrite: true path: /path/to/dashboards/foo.json - name: Import Grafana dashboard Zabbix diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index 5f865ec5..0b2d1b64 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -86,7 +86,7 @@ type: str basic_auth_password: description: - - The datasource basic auth password, when C(basic auth) is C(yes). + - The datasource basic auth password, when C(basic auth) is C(true). - Stored as secure data, see C(enforce_secure_data) and notes! type: str with_credentials: @@ -94,7 +94,7 @@ - Whether credentials such as cookies or auth headers should be sent with cross-site requests. type: bool - default: 'no' + default: false tls_client_cert: description: - The client TLS certificate. @@ -123,7 +123,7 @@ description: - Make this datasource the default one. type: bool - default: 'no' + default: false org_id: description: - Grafana Organisation ID in which the datasource should be created. @@ -217,7 +217,7 @@ description: - Use trends or not for zabbix datasource type. type: bool - default: False + default: false aws_auth_type: description: - Type for AWS authentication for CloudWatch datasource type (authType of grafana diff --git a/plugins/modules/grafana_folder.py b/plugins/modules/grafana_folder.py index 380a510c..4dcb8453 100644 --- a/plugins/modules/grafana_folder.py +++ b/plugins/modules/grafana_folder.py @@ -50,7 +50,7 @@ - This parameter can be useful if you enabled `hide_version` in grafana.ini required: False type: bool - default: False + default: false version_added: "1.2.0" extends_documentation_fragment: - community.grafana.basic_auth diff --git a/plugins/modules/grafana_notification_channel.py b/plugins/modules/grafana_notification_channel.py index eb808fa1..1913c290 100644 --- a/plugins/modules/grafana_notification_channel.py +++ b/plugins/modules/grafana_notification_channel.py @@ -82,17 +82,17 @@ - Required when I(state) is C(present). is_default: type: bool - default: 'no' + default: false description: - Use this channel for all alerts. include_image: type: bool - default: 'no' + default: false description: - Capture a visualization image and attach it to notifications. disable_resolve_message: type: bool - default: 'no' + default: false description: - Disable the resolve message. reminder_frequency: diff --git a/plugins/modules/grafana_plugin.py b/plugins/modules/grafana_plugin.py index 7fd41876..073de119 100644 --- a/plugins/modules/grafana_plugin.py +++ b/plugins/modules/grafana_plugin.py @@ -50,7 +50,7 @@ validate_certs: description: - Boolean variable to include --insecure while installing pluging - default: False + default: false type: bool ''' diff --git a/plugins/modules/grafana_team.py b/plugins/modules/grafana_team.py index 7f8de845..b7b2318d 100644 --- a/plugins/modules/grafana_team.py +++ b/plugins/modules/grafana_team.py @@ -59,7 +59,7 @@ description: - Delete the members not found in the C(members) parameters from the - list of members found on the Team. - default: False + default: false type: bool skip_version_check: description: @@ -67,7 +67,7 @@ - This parameter can be useful if you enabled `hide_version` in grafana.ini required: False type: bool - default: False + default: false version_added: "1.2.0" extends_documentation_fragment: - community.grafana.basic_auth @@ -104,7 +104,7 @@ members: - john.doe@example.com - jane.doe@example.com - enforce_members: yes + enforce_members: true state: present - name: Delete a team From c57b9cdfa4de326dd348310a77a59efa68c1ac46 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Mon, 13 Nov 2023 16:52:04 +0100 Subject: [PATCH 32/32] add changelog fragment --- changelogs/fragments/325_true_false.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/325_true_false.yml diff --git a/changelogs/fragments/325_true_false.yml b/changelogs/fragments/325_true_false.yml new file mode 100644 index 00000000..c192d086 --- /dev/null +++ b/changelogs/fragments/325_true_false.yml @@ -0,0 +1,2 @@ +minor_changes: +- default to true/false in docs and code