Skip to content

Commit

Permalink
Merge pull request #234 from SUNET/jocar-improve-apt-for-grafana-apps
Browse files Browse the repository at this point in the history
The Grafana repo can be used for many products
  • Loading branch information
theseal authored Jan 7, 2025
2 parents 4546a97 + b1785e4 commit 5ed57d7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
File renamed without changes.
22 changes: 22 additions & 0 deletions manifests/apt/repo_grafana.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Expose the grafana apt repo.
# E.g used for alloy and grafana
define sunet::apt::repo_grafana (
) {
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',
}
}
23 changes: 3 additions & 20 deletions manifests/otel/alloy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 5ed57d7

Please sign in to comment.