diff --git a/.github/workflows/mimir-molecule.yml b/.github/workflows/mimir-molecule.yml index b9d1a083..41c2b0d6 100644 --- a/.github/workflows/mimir-molecule.yml +++ b/.github/workflows/mimir-molecule.yml @@ -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 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5d36543b..91367ffd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index e3a34000..8a38bfd9 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -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' diff --git a/galaxy.yml b/galaxy.yml index a3b780fd..2464d6cd 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: grafana name: grafana -version: 5.3.0 +version: 5.4.0 readme: README.md authors: - Grafana Labs diff --git a/roles/loki/README.md b/roles/loki/README.md index 73ee9955..32b69488 100644 --- a/roles/loki/README.md +++ b/roles/loki/README.md @@ -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 @@ -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 ``` @@ -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 diff --git a/roles/loki/defaults/main.yml b/roles/loki/defaults/main.yml index ee712bb2..27072242 100644 --- a/roles/loki/defaults/main.yml +++ b/roles/loki/defaults/main.yml @@ -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 diff --git a/roles/loki/tasks/main.yml b/roles/loki/tasks/main.yml index 4e0bb741..bb87e157 100644 --- a/roles/loki/tasks/main.yml +++ b/roles/loki/tasks/main.yml @@ -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 diff --git a/roles/loki/vars/Debian.yml b/roles/loki/vars/Debian.yml index b211affe..7aa0ed1f 100644 --- a/roles/loki/vars/Debian.yml +++ b/roles/loki/vars/Debian.yml @@ -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) }}" diff --git a/roles/mimir/README.md b/roles/mimir/README.md index aac0c1e4..a1006a8f 100644 --- a/roles/mimir/README.md +++ b/roles/mimir/README.md @@ -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 @@ -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` ``` @@ -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.| diff --git a/roles/mimir/defaults/main.yml b/roles/mimir/defaults/main.yml index 40ab730e..afd6dbdc 100644 --- a/roles/mimir/defaults/main.yml +++ b/roles/mimir/defaults/main.yml @@ -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" diff --git a/roles/mimir/molecule/test-requirements.txt b/roles/mimir/molecule/test-requirements.txt deleted file mode 100644 index af58c110..00000000 --- a/roles/mimir/molecule/test-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -molecule -docker -pytest-testinfra -jmespath -selinux -passlib diff --git a/roles/mimir/tasks/main.yml b/roles/mimir/tasks/main.yml index 880c6e5a..4e4e8c7a 100644 --- a/roles/mimir/tasks/main.yml +++ b/roles/mimir/tasks/main.yml @@ -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 diff --git a/roles/promtail/README.md b/roles/promtail/README.md index 1fbcb550..44b1f4fb 100644 --- a/roles/promtail/README.md +++ b/roles/promtail/README.md @@ -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.** @@ -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 ``` @@ -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 diff --git a/roles/promtail/defaults/main.yml b/roles/promtail/defaults/main.yml index 277037bf..ec8cb241 100644 --- a/roles/promtail/defaults/main.yml +++ b/roles/promtail/defaults/main.yml @@ -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 diff --git a/roles/promtail/tasks/main.yml b/roles/promtail/tasks/main.yml index 11bfdbf1..145db0c1 100644 --- a/roles/promtail/tasks/main.yml +++ b/roles/promtail/tasks/main.yml @@ -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 diff --git a/roles/promtail/vars/Debian.yml b/roles/promtail/vars/Debian.yml index f9d41b28..f7471e1e 100644 --- a/roles/promtail/vars/Debian.yml +++ b/roles/promtail/vars/Debian.yml @@ -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) }}"