Skip to content

Commit

Permalink
Merge branch 'grafana:main' into grafana_plugins_ops
Browse files Browse the repository at this point in the history
  • Loading branch information
weakcamel authored Aug 13, 2024
2 parents d8b7eb9 + c775eb8 commit b34b7d6
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mimir-molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install molecule molecule-plugins[docker] docker pytest-testinfra jmespath selinux passlib
run: pip3 install ansible-core==2.16 'molecule-plugins[docker]' pytest-testinfra jmespath selinux passlib

- name: create docker network
run: docker network create molecule
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Grafana.Grafana Release Notes

.. contents:: Topics

v5.4.0
======

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

- fix: Use a variable to control uninstall behavior instead of tags by @dobbi84 in https://github.com/grafana/grafana-ansible-collection/pull/253

v5.3.0
======

Expand Down
5 changes: 5 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,8 @@ releases:
- Bump pylint from 3.2.3 to 3.2.5 by @dependabot in https://github.com/grafana/grafana-ansible-collection/pull/234
- Fix Grafana Configuration for Unified and Legacy Alerting Based on Version by @voidquark in https://github.com/grafana/grafana-ansible-collection/pull/215
release_date: '2024-07-12'
5.4.0:
changes:
major_changes:
- fix: Use a variable to control uninstall behavior instead of tags by @dobbi84 in https://github.com/grafana/grafana-ansible-collection/pull/253
release_date: '2024-08-09'
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.3.0
version: 5.4.0
readme: README.md
authors:
- Grafana Labs <grafana.com>
Expand Down
11 changes: 9 additions & 2 deletions roles/loki/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Ansible Loki Role allows you to effortlessly deploy and manage [Loki](https:

**🔑 Key Features**
- **📦 Out-of-the-box Deployment**: Get Loki up and running quickly with default configurations.
- **🧹 Effortless Uninstall**: Easily remove Loki from your system using the "loki_uninstall" tag.
- **🧹 Effortless Uninstall**: Easily remove Loki from your system setting the "loki_uninstall" variable.
- **🔔 Example Alerting Rules**: Benefit from the included sample Ruler configuration. Utilize the provided example alerting rules as a reference guide for structuring your own rules effectively.

## Table of Content
Expand All @@ -32,8 +32,15 @@ The Ansible Loki Role allows you to effortlessly deploy and manage [Loki](https:
```yaml
loki_version: "latest"
```
The version of Loki to download and deploy. Supported standard version "3.0.0" format or "latest".
```yaml
loki_uninstall: "false"
```
If set to `true` will perfom uninstall instead of deployment.

```yaml
loki_http_listen_port: 3100
```
Expand Down Expand Up @@ -226,7 +233,7 @@ Below variables allow you to extend Loki configuration to fit your needs. Always
ansible-playbook -i inventory/hosts playbook/function_loki_play.yml
# Uninstall
ansible-playbook -i inventory/hosts playbook/function_loki_play.yml -t loki_uninstall
ansible-playbook -i inventory/hosts playbook/function_loki_play.yml -e "loki_uninstall=true"
```

## License
Expand Down
1 change: 1 addition & 0 deletions roles/loki/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
# defaults file for loki
loki_version: "latest"
loki_uninstall: false
loki_http_listen_port: 3100
loki_http_listen_address: "0.0.0.0"
loki_expose_port: false
Expand Down
12 changes: 2 additions & 10 deletions roles/loki/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@
- name: Deploy Loki service
ansible.builtin.include_tasks:
file: "deploy.yml"
apply:
tags: loki_deploy
tags: loki_deploy
when: not loki_uninstall

- name: Uninstall Loki service
ansible.builtin.include_tasks:
file: "uninstall.yml"
apply:
tags:
- loki_uninstall
- never
tags:
- loki_uninstall
- never
when: loki_uninstall
3 changes: 3 additions & 0 deletions roles/loki/vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
__loki_arch_map:
x86_64: 'amd64'
armv6l: 'arm'
armv7l: 'arm'
aarch64: 'arm64'

__loki_arch: "{{ __loki_arch_map[ansible_architecture] | default(ansible_architecture) }}"
9 changes: 5 additions & 4 deletions roles/mimir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ source .venv/bin/activate
.\.venv\Scripts\activate

# Install dependencies
pip3 install molecule molecule-plugins[docker] docker pytest-testinfra jmespath selinux passlib
pip3 install ansible-core==2.16 'molecule-plugins[docker]' pytest-testinfra jmespath selinux passlib

# Create molecule network
docker network create molecule
Expand All @@ -49,12 +49,12 @@ docker run -d \
### Testing the changes
To test the changes in a role run:
```sh
molecule converge
## example: molecule converge
molecule converge
## example: molecule converge
```
When Ansible has succesfully ran, you can run assertions against your infrastructure using.
```sh
molecule verify
molecule verify
## example: `molecule verify`
```

Expand All @@ -65,6 +65,7 @@ You can also run commands like `molecule destroy`, `molecule prepare`, and `mole
| Name | Type | Default | Description |
|---|---|---|---|
mimir_working_path|str|/usr/share/mimir|Used to specify the directory path where Mimir, a component of the Grafana Agent, stores its working files and temporary data.|
mimir_uninstall|bool|false|If set to `true` will perfom uninstall instead of deployment.|
mimir_ruler_alert_path|str|/data/ruler|Used to specify the directory path where the Mimir ruler component of the Grafana Agent stores its alert files.|
mimir_http_listen_port|str|8080|Used to specify the port number on which the Mimir component of the Grafana Agent listens for incoming HTTP requests.|
mimir_http_listen_address|str|0.0.0.0|Used to specify the network address on which the Mimir component of the Grafana Agent listens for incoming HTTP requests.|
Expand Down
1 change: 1 addition & 0 deletions roles/mimir/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
# defaults file for mimir
mimir_version: "latest"
mimir_uninstall: false
__mimir_arch: "{{ arch_mapping[ansible_architecture] | default('amd64') }}"
mimir_download_url_rpm: "https://github.com/grafana/mimir/releases/download/{{ mimir_version }}/{{ mimir_version }}_{{ __mimir_arch }}.rpm"
mimir_download_url_deb: "https://github.com/grafana/mimir/releases/download/{{ mimir_version }}/{{ mimir_version }}_{{ __mimir_arch }}.deb"
Expand Down
6 changes: 0 additions & 6 deletions roles/mimir/molecule/test-requirements.txt

This file was deleted.

12 changes: 2 additions & 10 deletions roles/mimir/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
- name: Deploy Mimir service
ansible.builtin.include_tasks:
file: "deploy.yml"
apply:
tags: mimir_deploy
tags: mimir_deploy
when: not mimir_uninstall

- name: Uninstall Mimir service
ansible.builtin.include_tasks:
file: "uninstall.yml"
apply:
tags:
- mimir_uninstall
- never
tags:
- mimir_uninstall
- never
when: mimir_uninstall
10 changes: 8 additions & 2 deletions roles/promtail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This role is tailored for operating systems such as **RedHat**, **Rocky Linux**,

**🔑 Key Features**
- **⚡ Root-less/Root runtime**: By default, Promtail operates in root-less mode, utilizing ACL (Access Control List) to securely access logs without requiring root permissions. You have the option to configure root mode if necessary.
- **🧹 Effortless Uninstall**: Easily remove Promtail from your system using the "promtail_uninstall" tag.
- **🧹 Effortless Uninstall**: Easily remove Promtail from your system setting the "promtail_uninstall" variable.

📢 **[Check the blog post](https://voidquark.com/blog/rootless-promtail-with-ansible/)** 📝 **Learn more about root-less mode.**

Expand All @@ -28,6 +28,12 @@ promtail_version: "latest"
```
The version of Promtail to download and deploy. Supported standard version "3.0.0" format or "latest".
```yaml
promtail_uninstall: "false"
```
If set to `true` will perfom uninstall instead of deployment.

```yaml
promtail_http_listen_port: 9080
```
Expand Down Expand Up @@ -152,7 +158,7 @@ No Dependencies
ansible-playbook function_promtail_play.yml
# Uninstall Promtail
ansible-playbook function_promtail_play.yml -t promtail_uninstall
ansible-playbook function_promtail_play.yml -e "promtail_uninstall=true"
```

## License
Expand Down
1 change: 1 addition & 0 deletions roles/promtail/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
# defaults file for promtail
promtail_version: "latest"
promtail_uninstall: false
promtail_http_listen_port: 9080
promtail_http_listen_address: "0.0.0.0"
promtail_expose_port: false
Expand Down
12 changes: 2 additions & 10 deletions roles/promtail/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@
- name: Deploy Promtail service
ansible.builtin.include_tasks:
file: "deploy.yml"
apply:
tags: promtail_deploy
tags: promtail_deploy
when: not promtail_uninstall

- name: Uninstall Promtail service
ansible.builtin.include_tasks:
file: "uninstall.yml"
apply:
tags:
- promtail_uninstall
- never
tags:
- promtail_uninstall
- never
when: promtail_uninstall
3 changes: 3 additions & 0 deletions roles/promtail/vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
__promtail_arch_map:
x86_64: 'amd64'
armv6l: 'arm'
armv7l: 'arm'
aarch64: 'arm64'

__promtail_arch: "{{ __promtail_arch_map[ansible_architecture] | default(ansible_architecture) }}"

0 comments on commit b34b7d6

Please sign in to comment.