puppet: Swap the one use of the cron resource for an /etc/cron.d file.

The `cron` resource places its contents in the user's crontab, which
makes it unlike every other cron job that Zulip installs.

Switch to using `/etc/cron.d` files, like all other cron jobs.
This commit is contained in:
Alex Vandiver 2021-11-16 10:54:45 -08:00 committed by Tim Abbott
parent 90e1a0400e
commit 83091cbc96
2 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,3 @@
PATH=/bin:/usr/bin:/usr/local/bin
0 2 * * * postgres /usr/local/bin/pg_backup_and_purge

View File

@ -43,15 +43,26 @@ class zulip::postgresql_backups {
],
}
# Zulip 4.x and before used the `cron` resource here, which placed
# this in the postgres user's crontab, which was not discoverable.
# Removed 2021-11 in version 5.0; these lines can be removed when we
# drop support for upgrading from Zulip 4 or older.
cron { 'pg_backup_and_purge':
ensure => present,
ensure => absent,
command => '/usr/local/bin/pg_backup_and_purge',
environment => 'PATH=/bin:/usr/bin:/usr/local/bin',
hour => 2,
minute => 0,
target => 'postgres',
user => 'postgres',
require => File['/usr/local/bin/pg_backup_and_purge'],
}
file { '/etc/cron.d/pg_backup_and_purge':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/zulip/cron.d/pg-backup-and-purge',
require => File['/usr/local/bin/pg_backup_and_purge'],
}
file { "${zulip::common::nagios_plugins_dir}/zulip_postgresql_backups":