From 0b09b1f67f9a7a49f866f2bbe2c5e3ebeb3cfd16 Mon Sep 17 00:00:00 2001 From: Francis Kayiwa Date: Wed, 20 Nov 2024 10:53:25 -0500 Subject: [PATCH] configure the apt repo and keys the shell command is needed to ensure that the downloaded key from grafana gets dearmored. added linting on the tasks we have a successful install of promtail, loki and grafana Co-authored-by: Beck Davis Co-authored-by: Vickie Karasic --- roles/logs/tasks/main.yml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/roles/logs/tasks/main.yml b/roles/logs/tasks/main.yml index f73d3f06ce..12521949be 100644 --- a/roles/logs/tasks/main.yml +++ b/roles/logs/tasks/main.yml @@ -1,29 +1,26 @@ --- # tasks file for roles/logs -- name: logs | ensure grafana key ring exists +- name: Logs | ensure grafana key ring exists ansible.builtin.file: path: /etc/apt/keyrings/ state: directory mode: '0755' -- name: logs | add grafana key and repo - block: - - name: grafanarepo |no apt key - ansible.builtin.get_url: - url: https://apt.grafana.com/gpg.key - dest: /etc/apt/keyrings/grafana.gpg +- name: Logs | add grafana key and repo + ansible.builtin.shell: /usr/bin/wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor > /etc/apt/keyrings/grafana.gpg + changed_when: false - - name: grafanarepo | apt source - ansible.builtin.apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main {{ ansible_distribution_release }} stable" - state: present - file: grafana +- name: Grafanarepo | apt source + ansible.builtin.apt_repository: + repo: "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" + state: present + filename: grafana -- name: logs | install grafana and promtail +- name: Logs | install grafana and promtail ansible.builtin.apt: name: "{{ item }}" update_cache: true - loop: + loop: - grafana - loki - - promtail \ No newline at end of file + - promtail