Extract sunet-cdnp and create symlink in PATH

Store files in /var/lib/sunet-cdnp instead of /root
This commit is contained in:
Patrik Lundin 2024-10-31 15:26:08 +01:00
parent 19aa10dc05
commit e15225d1b5
Signed by: patlu
GPG key ID: A0A812BA2249F294

View file

@ -127,10 +127,31 @@ class cdn::cache(
rule => 'add rule inet filter input meta iifname ip6tnl0 ip6 daddr 2001:6b0:2100::/48 tcp dport { 80, 443 } counter accept comment "sunet-cdn-service6"'
}
# Download CDN purger
exec { "curl -LO https://github.com/SUNET/sunet-cdnp/releases/download/v${sunet_cdnp_version}/sunet-cdnp_${sunet_cdnp_version}_linux_${facts[os][architecture]}.tar.gz":
creates => "/root/sunet-cdnp_${sunet_cdnp_version}_linux_${facts[os][architecture]}.tar.gz",
cwd => '/root'
$sunet_cdnp_dir = '/var/lib/sunet-cdnp'
$sunet_cdnp_file = "sunet-cdnp_${sunet_cdnp_version}_linux_${facts[os][architecture]}.tar.gz"
$sunet_cdnp_url = "https://github.com/SUNET/sunet-cdnp/releases/download/v${sunet_cdnp_version}/${sunet_cdnp_file}"
# Create directory for managing CDP purger
file { $sunet_cdnp_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
exec { "curl -LO ${sunet_cdnp_url}":
creates => "${sunet_cdnp_dir}/${sunet_cdnp_file}",
cwd => $sunet_cdnp_dir
notify => Exec["tar -xzf ${sunet_cdnp_file} sunet-cdnp"],
}
exec { "tar -xzf ${sunet_cdnp_file} sunet-cdnp":
cwd => $sunet_cdnp_dir
refreshonly => true,
}
file { '/usr/local/bin/sunet-cdnp':
ensure => link,
target => "${sunet_cdnp_dir}/sunet-cdnp",
}
if $cache_secrets {