X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fstaticsync%2Fmanifests%2Fstatic_mirror.pp;h=c35e99664af32767fe247da7b6316790e606b231;hb=013262d64aa0d8519074c9c5028d78d0beab4ef5;hp=380ad3dac8e68d9261b763ecf36ae281d6c981fd;hpb=0c067639ec7d7050b69249b85e6aa83ab91820b5;p=mirror%2Fdsa-puppet.git diff --git a/modules/staticsync/manifests/static_mirror.pp b/modules/staticsync/manifests/static_mirror.pp index 380ad3dac..c35e99664 100644 --- a/modules/staticsync/manifests/static_mirror.pp +++ b/modules/staticsync/manifests/static_mirror.pp @@ -1,31 +1,45 @@ -# a static mirror +# a static mirror. It will get content for all components that it servers +# from each component's master. # -# this receives pushes from the master and then usually serves the content to the public -class roles::static_mirror { - include roles::static::base - include roles::static::srvdir +# Static mirrors register themselves via a stored-conf /etc/static-clients.conf +# that the masters collect. Mirrors can always pull, but they only get +# triggered if they are in /etc/static-clients.conf. So during initial +# setup it might make sense to not get triggered and thus block updates of +# components until all mirrors are in sync; set $get_triggered = false for that. +# +class staticsync::static_mirror ( + Boolean $get_triggered = true, +) { + include staticsync::base + include staticsync::srvdir # mirrors talk only to masters - class { 'roles::static::ssh': + class { 'staticsync::ssh': add_tag => 'staticsync-master', collect_tag => 'staticsync-mirror', } file { '/usr/local/bin/static-mirror-run': - source => 'puppet:///modules/roles/static-mirroring/static-mirror-run', + source => 'puppet:///modules/staticsync/static-mirror-run', mode => '0555', } - file { '/usr/local/bin/static-mirror-run-all': - source => 'puppet:///modules/roles/static-mirroring/static-mirror-run-all', + source => 'puppet:///modules/staticsync/static-mirror-run-all', mode => '0555', } - file { '/etc/cron.d/puppet-static-mirror': ensure => absent, } concat::fragment { 'puppet-crontab--static-mirror': - target => '/etc/cron.d/puppet-crontab', - content => @(EOF) - @reboot staticsync sleep 60; chronic static-mirror-run-all - | EOF + target => '/etc/cron.d/puppet-crontab', + content => @("EOF"), + @reboot ${staticsync::user} sleep 60; chronic static-mirror-run-all + | EOF + } + + if $get_triggered { + @@concat::fragment { "static-client-${::fqdn}": + tag => 'staticsync::static-mirrors-to-trigger', + content => $::fqdn, + target => '/etc/static-clients.conf', + } } }