Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental authored Jan 2, 2024
2 parents 2fee8ab + c57b9cd commit 4107371
Show file tree
Hide file tree
Showing 33 changed files with 279 additions and 97 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"
}
6 changes: 1 addition & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -45,9 +45,9 @@ jobs:
strategy:
fail-fast: false
matrix:
grafana_version: ["9.2.6", "8.5.15", "7.5.16"]
grafana_version: ["9.5.14", "8.5.27", "10.2.2"]
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 }}
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======

Expand Down
57 changes: 46 additions & 11 deletions 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 @@ -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.14", "8.5.27", "10.2.2"]
```

## Installation and Usage
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -118,14 +113,53 @@ 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: "[email protected]"
login: "batman"
password: "robin"
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.
Expand Down Expand Up @@ -219,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
16 changes: 16 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
6 changes: 6 additions & 0 deletions changelogs/fragments/285_fix_doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

minor_changes:
- Fix documentation url for Ansible doc website

...
5 changes: 5 additions & 0 deletions changelogs/fragments/294-bump-grafana-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +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)
7 changes: 7 additions & 0 deletions changelogs/fragments/318-org_users_by_org_name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

minor_changes:
- Add parameter `org_name` to `grafana_organization_user`

trivial:
- Add tests for new `grafana_organization_user`-parameter `org_name`
4 changes: 4 additions & 0 deletions changelogs/fragments/321-action-groups-org-users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

bugfixes:
- Add `grafana_organiazion_user` to `action_groups.grafana`
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/fix-316.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- Fix error with datasources configured without basicAuth
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: community
name: grafana
version: 1.6.0
version: 1.6.1
readme: README.md
authors:
- Rémi REY (@rrey)
Expand Down
2 changes: 1 addition & 1 deletion hacking/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests==2.28.0
requests==2.31.0
17 changes: 9 additions & 8 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
'''
6 changes: 3 additions & 3 deletions plugins/modules/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
Loading

0 comments on commit 4107371

Please sign in to comment.