From cc4c41bc4cf71dd86fdc53bdd8037df7733acac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Pierre?= Date: Mon, 28 Aug 2023 13:21:08 +0200 Subject: [PATCH] use new standard to configure Grafana APT source --- roles/grafana/README.md | 6 ++++-- roles/grafana/defaults/main.yml | 6 ++++-- roles/grafana/tasks/install.yml | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/roles/grafana/README.md b/roles/grafana/README.md index 861f7859..eb00b3f2 100644 --- a/roles/grafana/README.md +++ b/roles/grafana/README.md @@ -27,8 +27,10 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults | `grafana_yum_key` | https://packages.grafana.com/gpg.key | Yum repository gpg key | | `grafana_rhsm_subscription` | | rhsm subscription name (redhat subscription-manager) | | `grafana_rhsm_repo` | | rhsm repository name (redhat subscription-manager) | -| `grafana_apt_repo` | deb https://packages.grafana.com/oss/deb stable main | Apt repository string | -| `grafana_apt_key` | https://packages.grafana.com/gpg.key | Apt repository gpg key | +| `grafana_apt_release_channel` | stable | Apt release chanel (stable or beta) | +| `grafana_apt_arch` | {{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }} | Apt architecture | +| `grafana_apt_repo` | deb [arch={{ grafana_apt_arch }} signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com/ {{ grafana_apt_release_channel }} main | Apt repository string | +| `grafana_apt_key` | https://apt.grafana.com/gpg.key | Apt repository gpg key | | `grafana_instance` | {{ ansible_fqdn \| default(ansible_host) \| default(inventory_hostname) }} | Grafana instance name | | `grafana_logs_dir` | /var/log/grafana | Path to logs directory | | `grafana_data_dir` | /var/lib/grafana | Path to database directory | diff --git a/roles/grafana/defaults/main.yml b/roles/grafana/defaults/main.yml index b45af1ad..fb257209 100644 --- a/roles/grafana/defaults/main.yml +++ b/roles/grafana/defaults/main.yml @@ -8,8 +8,10 @@ grafana_yum_key: "https://packages.grafana.com/gpg.key" grafana_rhsm_subscription: "" grafana_rhsm_repo: "" -grafana_apt_repo: "deb https://packages.grafana.com/oss/deb stable main" -grafana_apt_key: "https://packages.grafana.com/gpg.key" +grafana_apt_release_channel: stable +grafana_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" +grafana_apt_repo: "deb [arch={{ grafana_apt_arch }} signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com/ {{ grafana_apt_release_channel }} main" +grafana_apt_key: "https://apt.grafana.com/gpg.key" # Should we use the provisioning capability when possible (provisioning require grafana >= 5.0) grafana_use_provisioning: true diff --git a/roles/grafana/tasks/install.yml b/roles/grafana/tasks/install.yml index 4b935db8..a8333321 100644 --- a/roles/grafana/tasks/install.yml +++ b/roles/grafana/tasks/install.yml @@ -71,10 +71,10 @@ environment: "{{ grafana_environment }}" block: - name: "Import Grafana apt gpg key" - ansible.builtin.apt_key: + ansible.builtin.get_url: url: "{{ grafana_apt_key }}" - state: present - validate_certs: false + dest: /usr/share/keyrings/grafana.key + mode: "0644" - name: "Add Grafana apt repository" ansible.builtin.apt_repository: