From 6fc484c543d91042c32f47119df46cc730c6800c Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Mon, 16 Dec 2024 13:22:49 +0100 Subject: [PATCH 1/5] The grafana repo contains many applications --- manifests/otel/alloy.pp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/manifests/otel/alloy.pp b/manifests/otel/alloy.pp index c9423537..8b3ad726 100644 --- a/manifests/otel/alloy.pp +++ b/manifests/otel/alloy.pp @@ -3,26 +3,9 @@ class sunet::otel::alloy ( String $otel_receiver = undef, ) { - file { '/etc/apt/keyrings' : - ensure => 'directory', - notify => Service['alloy'], - mode => '0644', - group => 'root' - } - file { '/etc/apt/keyrings/grafana.gpg' : - ensure => 'file', - notify => Service['alloy'], - mode => '0644', - group => 'root', - content => file( 'sunet/otel/grafana.gpg' ), - } - file { '/etc/apt/sources.list.d/grafana.list' : - ensure => 'file', - notify => Service['alloy'], - mode => '0644', - group => 'root', - content => 'deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main', - } + + ensure_resource('sunet::apt::repo_grafana', 'sunet-otel-alloy-grafana-repo') + exec { 'alloy_update': command => 'apt update', unless => 'dpkg -l alloy', From a2cb7aeab92b927e9d70ace098deee8b9fe92f32 Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Tue, 17 Dec 2024 08:33:49 +0100 Subject: [PATCH 2/5] Forgot to add the replacement class --- manifests/apt/repo_grafana.pp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 manifests/apt/repo_grafana.pp diff --git a/manifests/apt/repo_grafana.pp b/manifests/apt/repo_grafana.pp new file mode 100644 index 00000000..69fbb0b1 --- /dev/null +++ b/manifests/apt/repo_grafana.pp @@ -0,0 +1,23 @@ +# Expose the grafana apt repo. +# E.g used for alloy and grafana +define sunet::apt::repo_alloy ( +) { + } + file { '/etc/apt/keyrings' : + ensure => 'directory', + mode => '0644', + group => 'root' + } + file { '/etc/apt/keyrings/grafana.gpg' : + ensure => 'file', + mode => '0644', + group => 'root', + content => file( 'sunet/apt/grafana.gpg' ), + } + file { '/etc/apt/sources.list.d/grafana.list' : + ensure => 'file', + mode => '0644', + group => 'root', + content => 'deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main', + } +} From 5d8021c7153f72a9af1b41c160c3fa50e299d808 Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Tue, 7 Jan 2025 15:43:10 +0100 Subject: [PATCH 3/5] Syntax error --- manifests/apt/repo_grafana.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/apt/repo_grafana.pp b/manifests/apt/repo_grafana.pp index 69fbb0b1..aced34f6 100644 --- a/manifests/apt/repo_grafana.pp +++ b/manifests/apt/repo_grafana.pp @@ -2,7 +2,6 @@ # E.g used for alloy and grafana define sunet::apt::repo_alloy ( ) { - } file { '/etc/apt/keyrings' : ensure => 'directory', mode => '0644', From 37174ba0ffac3c3c014df2b40c6650c17794be4c Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Tue, 7 Jan 2025 15:45:10 +0100 Subject: [PATCH 4/5] The repo is for all grafana products --- manifests/apt/repo_grafana.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/apt/repo_grafana.pp b/manifests/apt/repo_grafana.pp index aced34f6..696b5d04 100644 --- a/manifests/apt/repo_grafana.pp +++ b/manifests/apt/repo_grafana.pp @@ -1,6 +1,6 @@ # Expose the grafana apt repo. # E.g used for alloy and grafana -define sunet::apt::repo_alloy ( +define sunet::apt::repo_grafana ( ) { file { '/etc/apt/keyrings' : ensure => 'directory', From 46508a5727ed56a7f966d547e5d6b7d3b0875f03 Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Tue, 7 Jan 2025 15:47:27 +0100 Subject: [PATCH 5/5] Files related to apt --- files/{otel => apt}/grafana.gpg | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename files/{otel => apt}/grafana.gpg (100%) diff --git a/files/otel/grafana.gpg b/files/apt/grafana.gpg similarity index 100% rename from files/otel/grafana.gpg rename to files/apt/grafana.gpg