Skip to content

Commit d5f8b97

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 d5f8b97

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

roles/grafana_agent/tasks/main.yml

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

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

0 commit comments

Comments
 (0)