Skip to content

Commit 5288aec

Browse files
author
Adam Kraitman
committed
Add cleanup tasks to resolve Grafana APT repository conflict
The new tasks remove the conflicting key file and duplicate repository entries before adding the standardized Grafana repository, ensuring a clean APT configuration Signed-off-by: Adam Kraitman <akraitma@li-8b09b2cc-35b7-11b2-a85c-cd1dbade58f9.ibm.com>
1 parent 0058713 commit 5288aec

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

roles/grafana_agent/tasks/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@
3232
when: ansible_pkg_mgr == "apt"
3333
register: keyrings_exists
3434

35+
- name: Remove conflicting Grafana key file if exists
36+
ansible.builtin.file:
37+
path: /etc/apt/keyrings/grafana.key
38+
state: absent
39+
when: ansible_pkg_mgr == "apt"
40+
41+
- name: Remove old Grafana APT repository if exists
42+
ansible.builtin.apt_repository:
43+
repo: "{{ item }}"
44+
state: absent
45+
loop:
46+
- "deb {{ grafana_apt_repo_url }} stable main"
47+
- "deb [signed-by=/etc/apt/keyrings/grafana.key] {{ grafana_apt_repo_url }} stable main"
48+
when: ansible_pkg_mgr == "apt"
49+
3550
- name: "Import Grafana GPG key"
3651
become: true
3752
ansible.builtin.get_url:

0 commit comments

Comments
 (0)