Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
panfantastic authored May 18, 2024
2 parents 27e31e3 + afba489 commit 17955b7
Show file tree
Hide file tree
Showing 29 changed files with 900 additions and 11 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/promtail-molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Promtail Molecule

on:
push:
branches:
- main
pull_request:
branches:
- main

defaults:
run:
working-directory: roles/promtail

jobs:
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
distro:
- rockylinux9
- ubuntu2204
- debian12

steps:
- name: Check out the codebase.
uses: actions/checkout@v4

- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install ansible molecule molecule-plugins[docker] docker

- name: Run Molecule tests.
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
12 changes: 11 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ Grafana.Grafana Release Notes

.. contents:: Topics

v5.2.0
======

Major Changes
-------------

- Bump ansible-lint from 24.2.2 to 24.2.3 by @dependabot in https://github.com/grafana/grafana-ansible-collection/pull/195
- Add promtail role by @voidquark in https://github.com/grafana/grafana-ansible-collection/pull/197
- Add a new config part to configure KeyCloak based auth by @he0s in https://github.com/grafana/grafana-ansible-collection/pull/191

v5.1.0
======

Minor Changes
Major Changes
-------------

- fix: Uninstall Step for Loki and Mimir by @voidquark in https://github.com/grafana/grafana-ansible-collection/pull/193
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/roles/opentelemetry_collector @ishanjainn
/roles/loki @voidquark @ishanjainn
/roles/mimir @GVengelen @gardar @ishanjainn
/roles/promtail @voidquark @ishanjainn
12 changes: 6 additions & 6 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![GitHub Last Commit](https://img.shields.io/github/last-commit/grafana/grafana-ansible-collection)](https://github.com/grafana/grafana-ansible-collection/tags)
[![GitHub Contributors](https://img.shields.io/github/contributors/grafana/grafana-ansible-collection)](https://github.com/grafana/grafana-ansible-collection/tags)

This collection (`grafana.grafana`) contains modules and roles to assist in automating the management of resources in **Grafana**, **Grafana Agent**, **OpenTelemetry Collector**, and **Loki** with Ansible.
This collection (`grafana.grafana`) contains modules and roles to assist in automating the management of resources in **Grafana**, **Grafana Agent**, **OpenTelemetry Collector**, **Loki**, **Mimir**, and **Promtail** with Ansible.

- [Ansible collection Documentation](https://docs.ansible.com/ansible/latest/collections/grafana/grafana/)
- [Grafana](https://grafana.com)
Expand Down Expand Up @@ -43,12 +43,14 @@ collections:

## Roles included in the collection

This collection includes the following roles to help set up and manage Grafana, Grafana Agent, OpenTelemetry Collector, and Loki:
This collection includes the following roles to help set up and manage Grafana, Grafana Agent, OpenTelemetry Collector, Loki, Mimir and Promtail:

- **Grafana**: Installs and configures Grafana on your target hosts.
- **Grafana Agent**: Deploys and configures Grafana Agent, allowing for efficient metrics, logs, and trace data shipping to Grafana Cloud or other endpoints.
- **OpenTelemetry Collector**: Sets up and configures the OpenTelemetry Collector, enabling advanced observability features through data collection and transmission.
- **Loki**: Deploy and manage Loki, the log aggregation system.
- **Mimir**: Deploy and manage Mimir, the scalable long-term storage for Prometheus.
- **Promtail**: Deploy and manage Promtail, the agent which ships the contents of local logs to a private Grafana Loki.

## Using this collection

Expand Down
2 changes: 1 addition & 1 deletion changelogs/.plugin-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ plugins:
strategy: {}
test: {}
vars: {}
version: 5.1.0
version: 5.2.0
7 changes: 7 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,10 @@ releases:
major_changes:
- fix: Uninstall Step for Loki and Mimir by @voidquark in https://github.com/grafana/grafana-ansible-collection/pull/193
release_date: '2024-05-07'
5.2.0:
changes:
major_changes:
- Bump ansible-lint from 24.2.2 to 24.2.3 by @dependabot in https://github.com/grafana/grafana-ansible-collection/pull/195
- Add promtail role by @voidquark in https://github.com/grafana/grafana-ansible-collection/pull/197
- Add a new config part to configure KeyCloak based auth by @he0s in https://github.com/grafana/grafana-ansible-collection/pull/191
release_date: '2024-05-13'
24 changes: 24 additions & 0 deletions examples/promtail-multiple-logs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- name: Deploy Promtail to ship logs to the local Loki instance
hosts: all
become: true
roles:
- role: grafana.grafana.promtail
vars:
promtail_clients:
- url: http://localhost:3100/loki/api/v1/push
promtail_scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: messages
instance: "{{ ansible_fqdn }}"
__path__: /var/log/messages
- targets:
- localhost
labels:
job: nginx
instance: "{{ ansible_fqdn }}"
__path__: /var/log/nginx/*.log
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: grafana
name: grafana
version: 5.1.0
version: 5.2.0
readme: README.md
authors:
- Grafana Labs <grafana.com>
Expand Down
1 change: 1 addition & 0 deletions roles/grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
| `grafana_snapshots` | {} | [snapshots](http://docs.grafana.org/installation/configuration/#snapshots) configuration section |
| `grafana_image_storage` | {} | [image storage](http://docs.grafana.org/installation/configuration/#external-image-storage) configuration section |
| `grafana_date_formats` | {} | [date formats](http://docs.grafana.org/installation/configuration/#date_formats) configuration section |
| `grafana_feature_toggles` | {} | [feature toggles](http://docs.grafana.org/installation/configuration/#feature_toggles) configuration section |
| `grafana_dashboards` | [] | List of dashboards which should be imported |
| `grafana_dashboards_dir` | "dashboards" | Path to a local directory containing dashboards files in `json` format |
| `grafana_datasources` | [] | List of datasources which should be configured |
Expand Down
21 changes: 21 additions & 0 deletions roles/grafana/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ grafana_ldap: {}
# - group_dn: "cn=alternative_admins,ou=groups,dc=grafana,dc=org"
# org_role: Admin

# Grafana KeyCloak auth
grafana_auth_generic_oauth: {}
# enabled: true
# name: "Keycloak-OAuth"
# allow_sign_up: true
# client_id: YOUR_APP_CLIENT_ID
# client_secret: YOUR_APP_CLIENT_SECRET
# scopes: "openid email profile offline_access roles"
# email_attribute_path: email
# login_attribute_path: username
# name_attribute_path: full_name
# auth_url: "https://<PROVIDER_DOMAIN>/realms/<REALM_NAME>/protocol/openid-connect/auth"
# token_url: "https://<PROVIDER_DOMAIN>/realms/<REALM_NAME>/protocol/openid-connect/token"
# api_url: "https://<PROVIDER_DOMAIN>/realms/<REALM_NAME>/protocol/openid-connect/userinfo"

grafana_session: {}
# provider: file
# provider_config: "sessions"
Expand Down Expand Up @@ -212,6 +227,12 @@ grafana_date_formats: {}
# use_browser_locale: true
# default_timezone: "browser"

# Feature toggles
# List of feature toggles: https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/feature-toggles/#feature-toggles
grafana_feature_toggles: {}
# autoMigrateOldPanels: true
# regressionTransformation: true

#######
# Plugins from https://grafana.com/plugins
grafana_plugins: []
Expand Down
16 changes: 16 additions & 0 deletions roles/grafana/templates/grafana.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,19 @@ provider = {{ grafana_image_storage.provider }}
{{ k }} = {{ v }}
{% endfor %}
{% endif %}

{% if grafana_feature_toggles != {} %}
# Feature toggles
[feature_toggles]
{% for k,v in grafana_feature_toggles.items() %}
{{ k }} = {{ v }}
{% endfor %}
{% endif %}

# Oauth_Keycloack
{% if grafana_auth_generic_oauth != {} %}
[auth.generic_oauth]
{% for k,v in grafana_auth_generic_oauth.items() %}
{{ k }} = {{ v }}
{% endfor %}
{% endif %}
Loading

0 comments on commit 17955b7

Please sign in to comment.