Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: telekom-mms.grafana role #343

Merged
merged 98 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
ce29867
initial commit
michaelamattes Jul 8, 2021
80e6d66
add docu
michaelamattes Jul 8, 2021
a8423b9
Add new file
michaelamattes Jul 8, 2021
0afc1ef
Update .ansible-lint
michaelamattes Jul 8, 2021
f533836
Update .ansible-lint
michaelamattes Jul 8, 2021
8c49d7d
Update .ansible-lint
michaelamattes Jul 8, 2021
26d2e3d
rm
michaelamattes Jul 8, 2021
97ed4bb
full path needed
michaelamattes Jul 8, 2021
ebccb3d
add further settings to existing tasks
michaelamattes Aug 26, 2021
12aa290
add gitlab-version-manager
michaelamattes Aug 27, 2021
16a3fb9
fix: variable names
michaelamattes Aug 27, 2021
afb5056
chore: version bump for v0.0.1 [skip ci]
Aug 27, 2021
2434956
add testing with github actions
Dec 8, 2021
df80f7a
fix datasource task
Dec 9, 2021
87c3ab6
change branch to main in release workflow
Dec 10, 2021
aafe201
update changelog
Dec 10, 2021
1836ca8
add galaxy release action
Dec 10, 2021
e728f03
rename galaxy action
Dec 10, 2021
5a36d32
trigger galaxy action on releases
Dec 10, 2021
1abeae5
add meta information to role
Dec 10, 2021
43d807e
fix galaxy action
Dec 10, 2021
e0cf716
Prettified Code!
rndmh3ro Dec 10, 2021
ebc18b5
update changelog
Dec 10, 2021
73be74a
Prettified Code!
rndmh3ro Dec 13, 2021
520c39e
Update release.yml
rndmh3ro Dec 16, 2021
3572225
update changelog
Dec 16, 2021
0acebe3
Add renovate.json
renovate-bot May 6, 2022
ef9a16e
Update actions/setup-python action to v4
renovate-bot Jun 8, 2022
cc8fbaf
Update actions/checkout action to v3
renovate[bot] Aug 5, 2022
66f707f
Update actions/checkout action to v3.1.0
renovate[bot] Oct 4, 2022
33c329c
Update creyD/prettier_action action to v4
renovate-bot May 9, 2022
cdfef81
Update robertdebock/galaxy-action action to v1.2.1
renovate-bot May 22, 2022
6d848b2
Update github-actions-x/commit action to v2.9
renovate-bot May 9, 2022
356df7c
Update actions/checkout action to v3.2.0
renovate[bot] Dec 19, 2022
cda114e
add Renovate Dependency Dashboard and automatic merge on patch updates
michaelamattes Dec 19, 2022
ae008d5
linting, move to telekom-mms, simplify tasks
Jul 10, 2023
666064f
use reusable workflows
Jul 10, 2023
67c8a12
rm proxy-vars in molecule
Jul 10, 2023
73ae491
dashboards should be created afoter folders
Jul 10, 2023
b0ed570
Prettified Code!
rndmh3ro Jul 11, 2023
abe4558
use reusable workflow for role publishing
Jul 11, 2023
39a44b6
update due to new release
Jul 11, 2023
ae2f07c
refactor: yaml anchor for grafana connection vars
Nemental Oct 11, 2023
bf65d52
feat: remove loop subelements
Nemental Oct 11, 2023
97a4878
style: minify yaml
Nemental Oct 11, 2023
39a2856
feat: added orga module task
Nemental Oct 11, 2023
c4dfc81
fix: orga task param
Nemental Oct 11, 2023
895d9bc
fix: module name
Nemental Oct 11, 2023
1ad47f9
chore: empty orga default
Nemental Oct 12, 2023
0c0e518
feat: organization user module (disabled)
Nemental Oct 13, 2023
e326ced
refactor: remove yaml anchor
Nemental Oct 17, 2023
246dc66
test: fix molecule tests
Nemental Oct 17, 2023
a4712a4
fix: removed in favor of #18
Nemental Oct 17, 2023
eaa1d18
chore: linting
Nemental Nov 1, 2023
346cdf2
test: overwrite dashboard
Nemental Nov 1, 2023
7bbc843
Revert "test: overwrite dashboard"
Nemental Nov 1, 2023
33a50e0
test: remove uid from dashboard
Nemental Nov 1, 2023
7435331
Prettified Code!
rndmh3ro Nov 1, 2023
8d5239f
add codeowners
rndmh3ro Nov 20, 2023
2b9a34c
Update release.yml
rndmh3ro Nov 20, 2023
9c187da
Update renovate.json
rndmh3ro Nov 20, 2023
f43e769
test(molecule): bump debian image and define platform
Nemental Nov 29, 2023
97e6e74
test(molecule): added variables for all test cases
Nemental Nov 29, 2023
dbe4a1f
test(molecule): no idempotence test for dashboard task
Nemental Nov 29, 2023
29800af
test(molecule): ansible lint complains role not found
Nemental Nov 29, 2023
462f097
fix: block module defaults instead of per task
Nemental Dec 7, 2023
d3d0fb9
chore: move role files
Nemental Jan 16, 2024
52aea77
chore: cleanup
Nemental Jan 16, 2024
17bfaac
Squashed commit of telekom-mms/ansible-role-grafana#18:
Nemental Jan 16, 2024
668b64b
Squashed commit of telekom-mms/ansible-role-grafana#20:
Nemental Jan 16, 2024
79d65a3
Squashed commit of telekom-mms/ansible-role-grafana#21:
Nemental Jan 16, 2024
73f24fb
chore: move role changelog
Nemental Jan 16, 2024
e9f0eb5
chore: undo move of meta runtime
Nemental Jan 16, 2024
e5ebd1f
chore: ansible-lint noqa args module url because of module_defaults
Nemental Jan 16, 2024
62909e3
chore: changelog fragment
Nemental Jan 16, 2024
b8ff5d8
ci: remove telekom-mms actions
Nemental Jan 16, 2024
ef14dbf
chore: remove release drafter conf
Nemental Jan 16, 2024
99350ea
docs: cleanup role readme
Nemental Jan 16, 2024
22218c1
ci: migrated ansible lint actions
Nemental Jan 16, 2024
4bb7ae1
fix: added missing module parameters
Nemental Jan 17, 2024
8629034
chore: cleanup role galaxy definition
Nemental Jan 17, 2024
12f7a6a
chore: ansible lint requires_ansible currently supported version
Nemental Jan 17, 2024
b4f3e6c
ci: bump ansible_version
Nemental Jan 19, 2024
8f4bab6
ci: migrate molecule workflow
Nemental Jan 19, 2024
5b23b6d
ci: molecule python version use var
Nemental Jan 19, 2024
70eb8cf
ci: pin ansible version for molecule tests
Nemental Jan 19, 2024
e1def6e
ci: install ansible-core from github to match versions
Nemental Jan 19, 2024
4d797b3
ci: fix role ref in converge
Nemental Jan 19, 2024
f00f69f
ci: bump setup-python v5, grafana service port def
Nemental Jan 19, 2024
80f12a9
ci: ansible lint exclude tests and fix dashboard example
Nemental Jan 19, 2024
cbd1f88
docs: remove telekom-mms section from readme
Nemental Jan 19, 2024
5a91dd8
docs: update role readme define all parameters
Nemental Jan 19, 2024
4a5fc2c
ci: update yamllint conf and move
Nemental Jan 19, 2024
302997d
ci: remove renovate conf
Nemental Jan 19, 2024
5714d07
ci: linting
Nemental Jan 19, 2024
5467880
docs: changelog fragment major to minor
Nemental Jan 19, 2024
b69e471
chore: remove old role changelog
Nemental Jan 19, 2024
b07a263
docs: role galaxy info
Nemental Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .config/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
exclude_paths:
- .github/
- tests/
- changelogs/
2 changes: 2 additions & 0 deletions .config/yamllint/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
extends: default
40 changes: 37 additions & 3 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
python_version: ["3.10"]
ansible_version: ["stable-2.13", "stable-2.14", "devel"]
ansible_version: ["stable-2.15", "stable-2.16", "devel"]
steps:
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
Expand All @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
python_version: ["3.10"]
ansible_version: ["stable-2.13", "stable-2.14", "devel"]
ansible_version: ["stable-2.15", "stable-2.16", "devel"]
steps:
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
Expand All @@ -46,7 +46,7 @@ jobs:
fail-fast: false
matrix:
grafana_version: ["9.5.14", "8.5.27", "10.2.2"]
ansible_version: ["stable-2.13", "stable-2.14", "devel"]
ansible_version: ["stable-2.15", "stable-2.16", "devel"]
python_version: ["3.10"]
services:
grafana:
Expand All @@ -58,3 +58,37 @@ jobs:
ansible-core-version: ${{ matrix.ansible_version }}
target-python-version: ${{ matrix.python_version }}
testing-type: integration

molecule:
runs-on: ubuntu-latest
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
strategy:
fail-fast: false
matrix:
grafana_version: ["9.5.14", "8.5.27", "10.2.2"]
ansible_version: ["stable-2.15", "stable-2.16", "devel"]
python_version: ["3.10"]
services:
grafana:
image: grafana/grafana:${{ matrix.grafana_version }}
ports: ["3000:3000"]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}

- name: Install dependencies
run: |
python -m pip install --no-cache-dir --upgrade pip
pip install "git+https://github.com/ansible/ansible@${{ matrix.ansible_version }}" molecule molecule-docker

- name: Test with molecule
run: |
molecule --version
molecule test
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ jobs:
uses: chartboost/ruff-action@v1
with:
src: ${{ steps.changed-files.outputs.all_changed_files }}
ansible:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run ansible-lint
uses: ansible/ansible-lint@main
39 changes: 0 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,45 +121,6 @@ In your playbooks, you can set [module defaults](https://github.com/ansible/ansi
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
2 changes: 2 additions & 0 deletions changelogs/fragments/343-telekom-mms-role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- Merged ansible role telekom-mms/ansible-role-grafana into ansible-collections/community.grafana
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ coverage:
round: down
range: "70...100"
fixes:
- "/ansible_collections/community/grafana/::"
- "/ansible_collections/community/grafana/::"
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
requires_ansible: ">=2.9.0"
requires_ansible: ">=2.14.0"
action_groups:
grafana:
- grafana_dashboard
Expand Down
48 changes: 48 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
- name: Converge
hosts: localhost
environment:
http_proxy: "{{ lookup('env', 'HTTP_PROXY') | default(omit) }}"
https_proxy: "{{ lookup('env', 'HTTPS_PROXY') | default(omit) }}"
no_proxy: "{{ lookup('env', 'NO_PROXY') | default(omit) }}"

vars:
grafana_url: http://localhost:3000
grafana_username: admin
grafana_password: admin

grafana_organizations:
- name: my_org

grafana_datasources:
- name: Loki
ds_type: loki
ds_url: http://127.0.0.1:3100
tls_skip_verify: true

grafana_folders:
- name: my_service
- name: other_service

grafana_teams:
- name: my_team
email: [email protected]

grafana_users:
- name: Test User
login: testuser
password: supersecure!123
email: [email protected]

grafana_organization_users:
- login: testuser
org_id: 1
- login: testuser
org_name: my_org

grafana_dashboards:
- folder: my_service
path: test_dashboard.json
overwrite: true

roles: [{role: community.grafana.grafana}]
21 changes: 21 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: rndmh3ro/docker-debian12-ansible:latest
command: ${MOLECULE_DOCKER_COMMAND:-/lib/systemd/systemd}
env:
container: docker
pre_build_image: true
platform: amd64
provisioner:
name: ansible
config_options:
defaults:
interpreter_python: auto_silent
callback_whitelist: profile_tasks, timer, yaml
verifier:
name: ansible
126 changes: 126 additions & 0 deletions molecule/default/test_dashboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 3,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "loki"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"datasource": {
"type": "loki"
},
"refId": "A"
}
],
"title": "Panel Title",
"type": "timeseries"
}
],
"refresh": "",
"schemaVersion": 33,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "New dashboard",
"uid": "ES5apb27k",
"version": 1,
"weekStart": ""
}
Loading
Loading