diff --git a/global/overlay/etc/puppet/modules/cdn/manifests/cache.pp b/global/overlay/etc/puppet/modules/cdn/manifests/cache.pp index 850a9f5..f20ccdf 100644 --- a/global/overlay/etc/puppet/modules/cdn/manifests/cache.pp +++ b/global/overlay/etc/puppet/modules/cdn/manifests/cache.pp @@ -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 {