Skip to content

Commit

Permalink
Merge branch 'main' into feat/dashboard-by-org-name
Browse files Browse the repository at this point in the history
  • Loading branch information
rndmh3ro authored Jan 3, 2024
2 parents 5a931eb + 757d7ae commit e9b2e3b
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 24 deletions.
13 changes: 12 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@
"code",
"test"
]
},
{
"login": "Nemental",
"name": "Moritz",
"avatar_url": "https://avatars.githubusercontent.com/u/15136847?v=4",
"profile": "https://nemental.de",
"contributions": [
"bug",
"code"
]
}
],
"contributorsPerLine": 7,
Expand All @@ -195,5 +205,6 @@
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true,
"commitConvention": "angular"
"commitConvention": "angular",
"commitType": "docs"
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-BADGE:START - Do not remove or modify this section -->
[![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-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

This repo hosts the `community.grafana` Ansible Collection.
Expand Down Expand Up @@ -253,6 +253,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prndrbr"><img src="https://avatars.githubusercontent.com/u/96344856?v=4?s=100" width="100px;" alt="Pierre"/><br /><sub><b>Pierre</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/issues?q=author%3Aprndrbr" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/miksonx"><img src="https://avatars.githubusercontent.com/u/5308184?v=4?s=100" width="100px;" alt="MiksonX"/><br /><sub><b>MiksonX</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/issues?q=author%3Amiksonx" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/amenzhinsky"><img src="https://avatars.githubusercontent.com/u/1308953?v=4?s=100" width="100px;" alt="Aliaksandr Mianzhynski"/><br /><sub><b>Aliaksandr Mianzhynski</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=amenzhinsky" title="Code">💻</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=amenzhinsky" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://nemental.de"><img src="https://avatars.githubusercontent.com/u/15136847?v=4?s=100" width="100px;" alt="Moritz"/><br /><sub><b>Moritz</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/issues?q=author%3ANemental" title="Bug reports">🐛</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=Nemental" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/325_true_false.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- default to true/false in docs and code
2 changes: 2 additions & 0 deletions changelogs/fragments/335-add-datasource-type-tempo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- Add support for Grafana Tempo datasource type (https://grafana.com/docs/grafana/latest/datasources/tempo/)
4 changes: 2 additions & 2 deletions plugins/callback/grafana_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
options:
grafana_url:
description: Grafana annotations api URL
required: True
required: true
env:
- name: GRAFANA_URL
ini:
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions plugins/doc_fragments/basic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
'''
4 changes: 2 additions & 2 deletions plugins/modules/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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
Expand Down Expand Up @@ -99,7 +99,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
Expand Down
12 changes: 7 additions & 5 deletions plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- camptocamp-prometheus-alertmanager-datasource
- loki
- redis-datasource
- tempo
type: str
ds_url:
description:
Expand Down Expand Up @@ -86,15 +87,15 @@
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:
description:
- 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.
Expand Down Expand Up @@ -123,7 +124,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.
Expand Down Expand Up @@ -217,7 +218,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
Expand Down Expand Up @@ -742,7 +743,8 @@ def setup_module_object():
'camptocamp-prometheus-alertmanager-datasource',
'sni-thruk-datasource',
'redis-datasource',
'loki']),
'loki',
'tempo']),
ds_url=dict(type='str'),
access=dict(default='proxy', choices=['proxy', 'direct']),
database=dict(type='str', default=""),
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/grafana_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/grafana_notification_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/grafana_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
validate_certs:
description:
- Boolean variable to include --insecure while installing pluging
default: False
default: false
type: bool
'''

Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/grafana_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
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:
- Skip Grafana version check and try to reach api endpoint anyway.
- 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
Expand Down Expand Up @@ -104,7 +104,7 @@
members:
- [email protected]
- [email protected]
enforce_members: yes
enforce_members: true
state: present
- name: Delete a team
Expand Down
78 changes: 78 additions & 0 deletions tests/integration/targets/grafana_datasource/tasks/tempo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
- name: Create tempo datasource
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: tempo
ds_url: tempo.company.com:3100

- debug:
var: result

- assert:
that:
- result.changed
- "result.msg == 'Datasource datasource-tempo created'"

- name: Check tempo datasource creation idempotency
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: tempo
ds_url: tempo.company.com:3100

- debug:
var: result

- assert:
that:
- not result.changed
- result.datasource.basicAuth == false
- result.datasource.isDefault == false
- result.datasource.jsonData.tlsAuth == false
- result.datasource.jsonData.tlsAuthWithCACert == false
- result.datasource.secureJsonFields.httpHeaderValue1 == true
- result.datasource.name == 'datasource-tempo'
- result.datasource.orgId == 1
- result.datasource.type == 'tempo'
- result.datasource.url == 'tempo.company.com:3100'
- result.datasource.withCredentials == false

- name: Delete tempo datasource
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
state: absent

- debug:
var: result

- assert:
that:
- result.changed

- name: Delete tempo datasource
register: result
grafana_datasource:
name: datasource-tempo
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
state: absent

- debug:
var: result

- assert:
that:
- not result.changed

0 comments on commit e9b2e3b

Please sign in to comment.