define backup($apphost, $appfqdn) {
cron { "backup-${apphost}-daily":
command => "/usr/bin/rsync -a $appfqdn:backups/ $backdir/daily
--delete",
hour => "2",
minute => fqdn_rand(60),
}
}
then elsewhere
@@backup { $::hostname:
appfqdn => $::fqdn,
apphost => $::hostname,
}
Easy enough, or so I thought. Some time after I initially wrote this,
I investigated some I/O spikes and sure enough, all of my backups are
running at the same minute -- the fqdn_rand is being calculated for
the backup server, not for the slaves being backed up.
I have worked around this by passing in a $minute argument, but this
seems a bit inelegant -- the slave certainly has no business
determining the backup schedule. Other than a feature request for
fqdn_rand to allow a value to be passed in, any ideas on a more
elegant way to accomplish this? Criticism welcome!
I have worked around this by passing in a $minute argument, but this
seems a bit inelegant -- the slave certainly has no business
determining the backup schedule. Other than a feature request for
fqdn_rand to allow a value to be passed in, any ideas on a more
elegant way to accomplish this? Criticism welcome!