Debian Codegraph @

ansible_collections/community/grafana/README.md

raw
1 # Grafana Collection for Ansible
2
3 [![Lint](https://github.com/ansible-collections/community.grafana/actions/workflows/lint.yml/badge.svg)](https://github.com/ansible-collections/community.grafana/actions/workflows/lint.yml)
4 [![CI](https://github.com/ansible-collections/community.grafana/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/ansible-collections/community.grafana/actions/workflows/ansible-test.yml)
5 [![Check and Update Releases](https://github.com/ansible-collections/community.grafana/actions/workflows/check_releases.yml/badge.svg)](https://github.com/ansible-collections/community.grafana/actions/workflows/check_releases.yml)
6 [![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.grafana)](https://codecov.io/gh/ansible-collections/community.grafana)
7 <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
8 [![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors-)
9 <!-- ALL-CONTRIBUTORS-BADGE:END -->
10
11 This repo hosts the `community.grafana` Ansible Collection.
12
13 The collection includes a variety of Ansible content to help automate the management of resources in Grafana.
14
15 ## Communication
16
17 * Join the Ansible forum:
18 * [Get Help](https://forum.ansible.com/c/help/6): get help or help others.
19 * [Posts tagged with 'grafana'](https://forum.ansible.com/tag/grafana): subscribe to participate in collection-related conversations.
20 * [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).
21 * [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts.
22 * [News & Announcements](https://forum.ansible.com/c/news/5): track project-wide announcements including social events.
23
24 * The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): used to announce releases and important changes.
25
26 For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html).
27
28 ## Included content
29
30 Click on the name of a plugin or module to view that content's documentation:
31
32 * **Connection Plugins**:
33 * **Filter Plugins**:
34 * **Inventory Source**:
35 * **Callback Plugins**:
36 * [grafana_annotations](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_annotations_callback.html)
37 * **Lookup Plugins**:
38 * [grafana_dashboard](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_dashboard_lookup.html)
39 * **Modules**:
40 * [grafana_dashboard](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_dashboard_module.html)
41 * [grafana_datasource](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_datasource_module.html)
42 * [grafana_folder](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_folder_module.html)
43 * [grafana_notification_channel](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_notification_channel_module.html)
44 * [grafana_contact_point](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_contact_point_module.html)
45 * [grafana_organization](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_organization_module.html)
46 * [grafana_organization_user](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_organization_user_module.html)
47 * [grafana_plugin](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_plugin_module.html)
48 * [grafana_team](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_team_module.html)
49 * [grafana_user](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_user_module.html)
50 * [grafana_silence](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_silence_module.html)
51
52 ## Supported Versions
53
54 We aim to keep the last 3 major versions of both **Grafana** and **Ansible** tested.
55 This collection is currently testing the modules against the following versions:
56
57 ```yaml
58 grafana_version: ["12.0.2", "11.6.3", "10.4.19"]
59 ansible_version: ["v2.19.0b7", "stable-2.18", "stable-2.17"]
60 ```
61
62 ## Installation and Usage
63
64 ### Installing the Collection from Ansible Galaxy
65
66 Before using the Grafana collection, you need to install it with the Ansible Galaxy CLI:
67
68 ansible-galaxy collection install community.grafana
69
70 You can also include it in a `requirements.yml` file and install it via `ansible-galaxy collection install -r requirements.yml`, using the format:
71
72 ```yaml
73 ---
74 collections:
75 - name: community.grafana
76 version: 1.3.1
77 ```
78
79 ### Using modules from the Grafana Collection in your playbooks
80
81 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:
82
83 ```yaml
84 ---
85 - hosts: localhost
86 gather_facts: false
87 connection: local
88
89 tasks:
90 - name: Ensure Influxdb datasource exists.
91 community.grafana.grafana_datasource:
92 name: "datasource-influxdb"
93 grafana_url: "https://grafana.company.com"
94 grafana_user: "admin"
95 grafana_password: "xxxxxx"
96 org_id: "1"
97 ds_type: "influxdb"
98 ds_url: "https://influx.company.com:8086"
99 database: "telegraf"
100 time_interval: ">10s"
101 tls_ca_cert: "/etc/ssl/certs/ca.pem"
102 ```
103
104 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.
105
106 ### Using module group defaults
107
108 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:
109
110 ```yaml
111 ---
112 - hosts: localhost
113 gather_facts: false
114 connection: local
115
116 module_defaults:
117 group/community.grafana.grafana:
118 grafana_url: "https://grafana.company.com"
119 grafana_user: "admin"
120 grafana_password: "xxxxxx"
121
122 tasks:
123 - name: Ensure Influxdb datasource exists.
124 community.grafana.grafana_datasource:
125 name: "datasource-influxdb"
126 org_id: "1"
127 ds_type: "influxdb"
128 ds_url: "https://influx.company.com:8086"
129 database: "telegraf"
130 time_interval: ">10s"
131 tls_ca_cert: "/etc/ssl/certs/ca.pem"
132
133 - name: Create or update a Grafana user
134 community.grafana.grafana_user:
135 name: "Bruce Wayne"
136 email: "[email protected]"
137 login: "batman"
138 password: "robin"
139 is_admin: true
140 ```
141
142 ## Testing and Development
143
144 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.
145
146 ### Testing with `ansible-test`
147
148 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).
149
150 You can run the collection's test suites with the commands:
151
152 ansible-test sanity --docker -v --color
153 ansible-test units --docker -v --color
154 ansible-test integration --docker -v --color
155
156 ## Publishing New Versions
157
158 The collection is automatically released on [Galaxy](//galaxy.ansible.com/community/grafana) when a tag is created on the repository.
159 The release pipeline is managed by the Ansible Team as the collection is part of the `community` namespace.
160
161 The current process for creating a tag is manual.
162
163 ## Changelogs
164
165 Abstract from Ansible requirements for Collections:
166
167 ```
168 * Every change that does not only affect docs or tests must have a changelog fragment.
169 * 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.
170 * Use your common sense!
171 * (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.)
172 * 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.
173 * The (x+1).0.0 changelog continues the x.0.0 changelog.
174 * 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.
175 * 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.
176 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.)
177 * Changelogs do not contain previous major releases, and only use the ancestor feature (in changelogs/changelog.yaml) to point to the previous major release.
178 * Changelog fragments are removed after a release is made.
179 ```
180
181 See [antsibull-changelog documentation](https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#changelog-fragment-categories) for fragments format.
182
183 Generate a new changelog:
184
185 1. Update the collection version in `galaxy.yml` if required.
186 2. Generate the changelog:
187
188 ```shell
189 antsibull-changelog release
190 ```
191
192 ## License
193
194 GNU General Public License v3.0 or later
195
196 See LICENCE to see the full text.
197
198 ## Contributing
199
200 Any contribution is welcome and we only ask contributors to:
201
202 * Provide *at least* integration tests for any contribution.
203 * 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.
204 * Create an issue for any significant contribution that would change a large portion of the code base.
205 * Use [ruff](https://github.com/astral-sh/ruff) to lint and [black](https://github.com/psf/black) to format your changes on python code.
206
207 ## Contributors ✨
208
209 Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
210
211 <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
212 <!-- prettier-ignore-start -->
213 <!-- markdownlint-disable -->
214 <table>
215 <tbody>
216 <tr>
217 <td align="center" valign="top" width="14.28%"><a href="https://github.com/gundalow"><img src="https://avatars1.githubusercontent.com/u/940557?v=4?s=100" width="100px;" alt="John R Barker"/><br /><sub><b>John R Barker</b></sub></a><br /><a href="#infra-gundalow" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=gundalow" title="Tests">⚠️</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=gundalow" title="Code">💻</a></td>
218 <td align="center" valign="top" width="14.28%"><a href="https://github.com/rrey"><img src="https://avatars1.githubusercontent.com/u/2752379?v=4?s=100" width="100px;" alt="Rémi REY"/><br /><sub><b>Rémi REY</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=rrey" title="Tests">⚠️</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=rrey" title="Documentation">📖</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=rrey" title="Code">💻</a></td>
219 <td align="center" valign="top" width="14.28%"><a href="https://aperogeek.fr"><img src="https://avatars1.githubusercontent.com/u/1336359?v=4?s=100" width="100px;" alt="Thierry Sallé"/><br /><sub><b>Thierry Sallé</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=seuf" title="Code">💻</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=seuf" title="Tests">⚠️</a></td>
220 <td align="center" valign="top" width="14.28%"><a href="http://antoine.tanzil.li"><img src="https://avatars0.githubusercontent.com/u/1068018?v=4?s=100" width="100px;" alt="Antoine"/><br /><sub><b>Antoine</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=Tailzip" title="Code">💻</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=Tailzip" title="Tests">⚠️</a></td>
221 <td align="center" valign="top" width="14.28%"><a href="https://github.com/pomverte"><img src="https://avatars0.githubusercontent.com/u/695230?v=4?s=100" width="100px;" alt="hvle"/><br /><sub><b>hvle</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=pomverte" title="Code">💻</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=pomverte" title="Tests">⚠️</a></td>
222 <td align="center" valign="top" width="14.28%"><a href="https://github.com/jual"><img src="https://avatars2.githubusercontent.com/u/4416541?v=4?s=100" width="100px;" alt="jual"/><br /><sub><b>jual</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=jual" title="Code">💻</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=jual" title="Tests">⚠️</a></td>
223 <td align="center" valign="top" width="14.28%"><a href="https://github.com/MCyprien"><img src="https://avatars2.githubusercontent.com/u/11160859?v=4?s=100" width="100px;" alt="MCyprien"/><br /><sub><b>MCyprien</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=MCyprien" title="Code">💻</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=MCyprien" title="Tests">⚠️</a></td>
224 </tr>
225 <tr>
226 <td align="center" valign="top" width="14.28%"><a href="https://twitter.com/RealRockaut"><img src="https://avatars0.githubusercontent.com/u/453368?v=4?s=100" width="100px;" alt="Markus Fischbacher"/><br /><sub><b>Markus Fischbacher</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=rockaut" title="Code">💻</a></td>
227 <td align="center" valign="top" width="14.28%"><a href="https://github.com/rverchere"><img src="https://avatars3.githubusercontent.com/u/232433?v=4?s=100" width="100px;" alt="Remi Verchere"/><br /><sub><b>Remi Verchere</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=rverchere" title="Code">💻</a></td>
228 <td align="center" valign="top" width="14.28%"><a href="http://akasurde.github.io"><img src="https://avatars1.githubusercontent.com/u/633765?v=4?s=100" width="100px;" alt="Abhijeet Kasurde"/><br /><sub><b>Abhijeet Kasurde</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=Akasurde" title="Documentation">📖</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=Akasurde" title="Tests">⚠️</a></td>
229 <td align="center" valign="top" width="14.28%"><a href="https://github.com/martinwangjian"><img src="https://avatars2.githubusercontent.com/u/1770277?v=4?s=100" width="100px;" alt="martinwangjian"/><br /><sub><b>martinwangjian</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=martinwangjian" title="Code">💻</a></td>
230 <td align="center" valign="top" width="14.28%"><a href="https://github.com/CWollinger"><img src="https://avatars2.githubusercontent.com/u/11299733?v=4?s=100" width="100px;" alt="cwollinger"/><br /><sub><b>cwollinger</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=cwollinger" title="Code">💻</a></td>
231 <td align="center" valign="top" width="14.28%"><a href="https://github.com/Andersson007"><img src="https://avatars3.githubusercontent.com/u/34477873?v=4?s=100" width="100px;" alt="Andrew Klychkov"/><br /><sub><b>Andrew Klychkov</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=Andersson007" title="Code">💻</a></td>
232 <td align="center" valign="top" width="14.28%"><a href="https://github.com/vnea"><img src="https://avatars.githubusercontent.com/u/10775422?v=4?s=100" width="100px;" alt="Victor"/><br /><sub><b>Victor</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=vnea" title="Code">💻</a></td>
233 </tr>
234 <tr>
235 <td align="center" valign="top" width="14.28%"><a href="https://github.com/paytroff"><img src="https://avatars.githubusercontent.com/u/93038288?v=4?s=100" width="100px;" alt="paytroff"/><br /><sub><b>paytroff</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=paytroff" title="Code">💻</a> <a href="https://github.com/ansible-collections/community.grafana/commits?author=paytroff" title="Tests">⚠️</a></td>
236 <td align="center" valign="top" width="14.28%"><a href="https://github.com/jseiser"><img src="https://avatars.githubusercontent.com/u/4855527?v=4?s=100" width="100px;" alt="Justin Seiser"/><br /><sub><b>Justin Seiser</b></sub></a><br /><a href="https://github.com/ansible-collections/community.grafana/commits?author=jseiser" title="Code">💻</a></td>
237 <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>
238 <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>
239 <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>
240 <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>
241 </tr>
242 </tbody>
243 </table>
244
245 <!-- markdownlint-restore -->
246 <!-- prettier-ignore-end -->
247
248 <!-- ALL-CONTRIBUTORS-LIST:END -->
249
250 This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!