Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ansible-collections/community.grafana
Grafana Collection for Ansible
https://github.com/ansible-collections/community.grafana
ansible ansible-collection grafana hacktoberfest
Last synced: 2 days ago
JSON representation
Grafana Collection for Ansible
- Host: GitHub
- URL: https://github.com/ansible-collections/community.grafana
- Owner: ansible-collections
- License: gpl-3.0
- Created: 2019-11-18T19:01:06.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-10T08:36:38.000Z (13 days ago)
- Last Synced: 2024-12-15T03:47:22.597Z (8 days ago)
- Topics: ansible, ansible-collection, grafana, hacktoberfest
- Language: Python
- Homepage: http://galaxy.ansible.com/community/grafana
- Size: 664 KB
- Stars: 131
- Watchers: 9
- Forks: 83
- Open Issues: 44
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Grafana Collection for Ansible
![](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-20-orange.svg?style=flat-square)](#contributors-)
This repo hosts the `community.grafana` Ansible Collection.
The collection includes a variety of Ansible content to help automate the management of resources in Grafana.
## Communication
* Join the Ansible forum:
* [Get Help](https://forum.ansible.com/c/help/6): get help or help others.
* [Posts tagged with 'grafana'](https://forum.ansible.com/tag/grafana): subscribe to participate in collection-related conversations.
* [Ansible Forum Group 'grafana-collection'](https://forum.ansible.com/g/grafana-collection): by joining the team you will automatically get subscribed to the posts tagged with [grafana](https://forum.ansible.com/tag/grafana).
* [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts.
* [News & Announcements](https://forum.ansible.com/c/news/5): track project-wide announcements including social events.* The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): used to announce releases and important changes.
For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html).
## Included content
Click on the name of a plugin or module to view that content's documentation:
- **Connection Plugins**:
- **Filter Plugins**:
- **Inventory Source**:
- **Callback Plugins**:
- [grafana_annotations](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_annotations_callback.html)
- **Lookup Plugins**:
- [grafana_dashboard](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_dashboard_lookup.html)
- **Modules**:
- [grafana_dashboard](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_dashboard_module.html)
- [grafana_datasource](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_datasource_module.html)
- [grafana_folder](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_folder_module.html)
- [grafana_notification_channel](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_notification_channel_module.html)
- [grafana_contact_point](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_contact_point_module.html)
- [grafana_organization](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_organization_module.html)
- [grafana_organization_user](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_organization_user_module.html)
- [grafana_plugin](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_plugin_module.html)
- [grafana_team](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_team_module.html)
- [grafana_user](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_user_module.html)
- [grafana_silence](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_silence_module.html)## Supported Grafana versions
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: ["11.4.0", "10.4.14", "9.5.20"]
```## Installation and Usage
### Installing the Collection from Ansible Galaxy
Before using the Grafana collection, you need to install it with the Ansible Galaxy CLI:
ansible-galaxy collection install community.grafana
You can also include it in a `requirements.yml` file and install it via `ansible-galaxy collection install -r requirements.yml`, using the format:
```yaml
---
collections:
- name: community.grafana
version: 1.3.1
```### Using modules from the Grafana Collection in your playbooks
You can either call modules by their Fully Qualified Collection Namespace (FQCN), like `community.grafana.grafana_datasource`, or you can call modules by their short name if you list the `community.grafana` collection in the playbook's `collections`, like so:
```yaml
---
- hosts: localhost
gather_facts: false
connection: localtasks:
- name: Ensure Influxdb datasource exists.
community.grafana.grafana_datasource:
name: "datasource-influxdb"
grafana_url: "https://grafana.company.com"
grafana_user: "admin"
grafana_password: "xxxxxx"
org_id: "1"
ds_type: "influxdb"
ds_url: "https://influx.company.com:8086"
database: "telegraf"
time_interval: ">10s"
tls_ca_cert: "/etc/ssl/certs/ca.pem"
```For documentation on how to use individual modules and other content included in this collection, please see the links in the 'Included content' section earlier in this README.
### Using module group defaults
In your playbooks, you can set [module defaults](https://github.com/ansible/ansible/blob/v2.12.3/docs/docsite/rst/user_guide/playbooks_module_defaults.rst#module-defaults-groups) for the `community.grafana.grafana` group to avoid repeating the same parameters (e.g., `grafana_url`, `grafana_user`, `grafana_password`) in your tasks:
```yaml
---
- hosts: localhost
gather_facts: false
connection: localmodule_defaults:
group/community.grafana.grafana:
grafana_url: "https://grafana.company.com"
grafana_user: "admin"
grafana_password: "xxxxxx"tasks:
- name: Ensure Influxdb datasource exists.
community.grafana.grafana_datasource:
name: "datasource-influxdb"
org_id: "1"
ds_type: "influxdb"
ds_url: "https://influx.company.com:8086"
database: "telegraf"
time_interval: ">10s"
tls_ca_cert: "/etc/ssl/certs/ca.pem"
- name: Create or update a Grafana user
community.grafana.grafana_user:
name: "Bruce Wayne"
email: "[email protected]"
login: "batman"
password: "robin"
is_admin: true
```## 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.
### Testing with `ansible-test`
The `tests` directory contains configuration for running sanity and integration tests using [`ansible-test`](https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html).
You can run the collection's test suites with the commands:
ansible-test sanity --docker -v --color
ansible-test units --docker -v --color
ansible-test integration --docker -v --color## Publishing New Versions
The collection is automatically released on [Galaxy](//galaxy.ansible.com/community/grafana) when a tag is created on the repository.
The release pipeline is managed by the Ansible Team as the collection is part of the `community` namespace.The current process for creating a tag is manual.
## Changelogs
Abstract from Ansible requirements for Collections:
```
* Every change that does not only affect docs or tests must have a changelog fragment.
* Exception: fixing/extending a feature that already has a changelog fragment and has not yet been released. Such PRs must always link to the original PR(s) they update.
* Use your common sense!
* (This might change later. The trivial category should then be used to document changes which are not important enough to end up in the text version of the changelog.)
* Fragments must not be added for new module PRs and new plugin PRs. The only exception are test and filter plugins: these are not automatically documented yet.
* The (x+1).0.0 changelog continues the x.0.0 changelog.
* A x.y.0 changelog with y > 0 is not part of a changelog of a later X.*.* (with X > x) or x,Y,* (with Y > y) release.
* A x.y.z changelog with z > 0 is not part of a changelog of a later (x+1).*.* or x.Y.z (with Y > y) release.
Since everything adding to the minor/patch changelogs are backports, the same changelog fragments of these minor/patch releases will be in the next major release's changelog. (This is the same behavior as in ansible/ansible.)
* Changelogs do not contain previous major releases, and only use the ancestor feature (in changelogs/changelog.yaml) to point to the previous major release.
* Changelog fragments are removed after a release is made.
```See [antsibull-changelog documentation](https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#changelog-fragment-categories) for fragments format.
Generate a new changelog:
1. Update the collection version in `galaxy.yml` if required.
2. Generate the changelog:
```
$ antsibull-changelog release
```## License
GNU General Public License v3.0 or later
See LICENCE to see the full text.
## Contributing
Any contribution is welcome and we only ask contributors to:
* Provide *at least* integration tests for any contribution.
* The Pull Request *MUST* contain a changelog fragment. See [Ansible documentation](https://docs.ansible.com/ansible/latest/community/development_process.html#creating-a-changelog-fragment) about fragments.
* Create an issue for any significant contribution that would change a large portion of the code base.
* Use [ruff](https://github.com/astral-sh/ruff) to lint and [black](https://github.com/psf/black) to format your changes on python code.## Contributors β¨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
John R Barker
π β οΈ π»
RΓ©mi REY
β οΈ π π»
Thierry SallΓ©
π» β οΈ
Antoine
π» β οΈ
hvle
π» β οΈ
jual
π» β οΈ
MCyprien
π» β οΈ
Markus Fischbacher
π»
Remi Verchere
π»
Abhijeet Kasurde
π β οΈ
martinwangjian
π»
cwollinger
π»
Andrew Klychkov
π»
Victor
π»
paytroff
π» β οΈ
Justin Seiser
π»
Pierre
π
MiksonX
π
Aliaksandr Mianzhynski
π» β οΈ
Moritz
π π»
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!