Skip to content

Commit

Permalink
configure the apt repo and keys
Browse files Browse the repository at this point in the history
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 <[email protected]>
Co-authored-by: Vickie Karasic <[email protected]>
  • Loading branch information
3 people committed Nov 20, 2024
1 parent e7462a3 commit 0b09b1f
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions roles/logs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
- promtail

0 comments on commit 0b09b1f

Please sign in to comment.