From 09fe4ba7c7716d3460f45e30b31675732217fe8a Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 28 Nov 2024 15:53:08 +0100 Subject: [PATCH] deploy fastly-purge scripts everywhere where needed --- .../files/fastly-purge-find.sh | 0 .../files/fastly-purge.sh | 0 puppet/modules/fastly_purge/manifests/init.pp | 19 +++++++++++++++++++ puppet/modules/jenkins_node/manifests/init.pp | 2 ++ puppet/modules/web/manifests/init.pp | 16 ---------------- puppet/modules/web/manifests/vhost/deb.pp | 2 ++ puppet/modules/web/manifests/vhost/rpm.pp | 2 ++ puppet/modules/web/manifests/vhost/yum.pp | 2 ++ 8 files changed, 27 insertions(+), 16 deletions(-) rename puppet/modules/{web => fastly_purge}/files/fastly-purge-find.sh (100%) rename puppet/modules/{web => fastly_purge}/files/fastly-purge.sh (100%) create mode 100644 puppet/modules/fastly_purge/manifests/init.pp diff --git a/puppet/modules/web/files/fastly-purge-find.sh b/puppet/modules/fastly_purge/files/fastly-purge-find.sh similarity index 100% rename from puppet/modules/web/files/fastly-purge-find.sh rename to puppet/modules/fastly_purge/files/fastly-purge-find.sh diff --git a/puppet/modules/web/files/fastly-purge.sh b/puppet/modules/fastly_purge/files/fastly-purge.sh similarity index 100% rename from puppet/modules/web/files/fastly-purge.sh rename to puppet/modules/fastly_purge/files/fastly-purge.sh diff --git a/puppet/modules/fastly_purge/manifests/init.pp b/puppet/modules/fastly_purge/manifests/init.pp new file mode 100644 index 000000000..2596c689a --- /dev/null +++ b/puppet/modules/fastly_purge/manifests/init.pp @@ -0,0 +1,19 @@ +# @summary scripts to manage fastly CDN purging +# +class fastly_purge { + file { '/usr/local/bin/fastly-purge': + ensure => file, + owner => 'root', + group => 'root', + mode => '0755', + content => file("${module_name}/fastly-purge.sh"), + } + + file { '/usr/local/bin/fastly-purge-find': + ensure => file, + owner => 'root', + group => 'root', + mode => '0755', + content => file("${module_name}/fastly-purge-find.sh"), + } +} diff --git a/puppet/modules/jenkins_node/manifests/init.pp b/puppet/modules/jenkins_node/manifests/init.pp index ebab2d7b1..f90695e2a 100644 --- a/puppet/modules/jenkins_node/manifests/init.pp +++ b/puppet/modules/jenkins_node/manifests/init.pp @@ -20,6 +20,8 @@ Boolean $unittests = $facts['os']['family'] == 'RedHat', Boolean $packaging = true, ) { + include fastly_purge + if $facts['os']['family'] == 'RedHat' { $java_package = 'java-11-openjdk-headless' diff --git a/puppet/modules/web/manifests/init.pp b/puppet/modules/web/manifests/init.pp index d8143d3ea..d03c66e6e 100644 --- a/puppet/modules/web/manifests/init.pp +++ b/puppet/modules/web/manifests/init.pp @@ -33,22 +33,6 @@ source => 'puppet:///modules/web/filter_apache_stats.sh', } - file { '/usr/local/bin/fastly-purge': - ensure => file, - owner => 'root', - group => 'root', - mode => '0755', - content => file('web/fastly-purge.sh'), - } - - file { '/usr/local/bin/fastly-purge-find': - ensure => file, - owner => 'root', - group => 'root', - mode => '0755', - content => file('web/fastly-purge-find.sh'), - } - # daily at 4am, should be fairly quiet on the server cron { 'filter_apache_stats': command => '/usr/bin/nice -19 /usr/local/bin/filter_apache_stats', diff --git a/puppet/modules/web/manifests/vhost/deb.pp b/puppet/modules/web/manifests/vhost/deb.pp index 62f8f5b40..e2fb43353 100644 --- a/puppet/modules/web/manifests/vhost/deb.pp +++ b/puppet/modules/web/manifests/vhost/deb.pp @@ -5,6 +5,8 @@ String $user = 'freight', Stdlib::Absolutepath $home = "/home/${user}", ) { + include fastly_purge + # Manual step: each user needs the GPG key in it's keyring freight::user { 'main': user => $user, diff --git a/puppet/modules/web/manifests/vhost/rpm.pp b/puppet/modules/web/manifests/vhost/rpm.pp index 6a14f6bcc..cb1127549 100644 --- a/puppet/modules/web/manifests/vhost/rpm.pp +++ b/puppet/modules/web/manifests/vhost/rpm.pp @@ -7,6 +7,8 @@ Stdlib::Absolutepath $rpm_staging_directory = '/var/www/vhosts/stagingrpm/htdocs/', String $user = 'rpmrepo', ) { + include fastly_purge + $rpm_directory_config = [ { path => $rpm_directory, diff --git a/puppet/modules/web/manifests/vhost/yum.pp b/puppet/modules/web/manifests/vhost/yum.pp index 0858750da..dea8eed9e 100644 --- a/puppet/modules/web/manifests/vhost/yum.pp +++ b/puppet/modules/web/manifests/vhost/yum.pp @@ -6,6 +6,8 @@ Stdlib::Absolutepath $yum_directory = '/var/www/vhosts/yum/htdocs', String $user = 'yumrepo', ) { + include fastly_purge + $yum_directory_config = [ { path => $yum_directory,