diff options
-rw-r--r-- | modules/base/manifests/operatingsystem.pp | 11 | ||||
-rw-r--r-- | modules/certbot/manifests/init.pp | 14 | ||||
-rw-r--r-- | modules/conf/manifests/init.pp | 1 | ||||
-rw-r--r-- | modules/conf/manifests/user.pp | 1 | ||||
-rw-r--r-- | modules/cron/manifests/job.pp | 8 | ||||
-rw-r--r-- | modules/locate/manifests/init.pp | 14 | ||||
-rw-r--r-- | modules/mail/manifests/mailu.pp | 14 | ||||
-rw-r--r-- | modules/partofme/manifests/persistent.pp | 19 | ||||
-rw-r--r-- | modules/tarsnap/manifests/init.pp | 19 | ||||
-rw-r--r-- | modules/tozt/manifests/metabase.pp | 22 |
10 files changed, 59 insertions, 64 deletions
diff --git a/modules/base/manifests/operatingsystem.pp b/modules/base/manifests/operatingsystem.pp index 4a65015..4229fcc 100644 --- a/modules/base/manifests/operatingsystem.pp +++ b/modules/base/manifests/operatingsystem.pp @@ -1,6 +1,4 @@ class base::operatingsystem { - include cron - file { "/etc/locale.gen": content => "en_US.UTF-8 UTF-8\n", @@ -18,10 +16,11 @@ class base::operatingsystem { content => template('base/hosts'); '/etc/yaourtrc': source => 'puppet:///modules/base/yaourtrc'; - '/etc/cron.hourly/pacman': - source => 'puppet:///modules/base/pacman-cron', - mode => '0755', - require => Class['cron']; + } + + cron::job { "pacman": + frequency => "hourly", + source => 'puppet:///modules/base/pacman-cron'; } exec { "regen locale data": diff --git a/modules/certbot/manifests/init.pp b/modules/certbot/manifests/init.pp index 8f3b4cb..200b854 100644 --- a/modules/certbot/manifests/init.pp +++ b/modules/certbot/manifests/init.pp @@ -6,7 +6,6 @@ class certbot($config_dir=undef) { $_config_dir = "/etc/letsencrypt" } - include cron include nginx $primary_domain = "tozt.net" @@ -31,13 +30,6 @@ class certbot($config_dir=undef) { } file { - '/etc/cron.daily/certbot': - content => template('certbot/certbot'), - mode => '0755', - require => [ - Package['certbot'], - Class['cron'], - ]; "${_config_dir}/renewal-hooks": ensure => directory, require => Package['certbot']; @@ -59,6 +51,12 @@ class certbot($config_dir=undef) { mode => '0755'; } + cron::job { "certbot": + frequency => "daily", + content => template('certbot/certbot'), + require => Package['certbot']; + } + exec { "initial certbot run": provider => shell, command => "/usr/local/bin/certbot-tozt ${config_dir}", diff --git a/modules/conf/manifests/init.pp b/modules/conf/manifests/init.pp index adc608e..4ffd7ad 100644 --- a/modules/conf/manifests/init.pp +++ b/modules/conf/manifests/init.pp @@ -1,6 +1,5 @@ class conf { include c_toolchain - include cron include git package { diff --git a/modules/conf/manifests/user.pp b/modules/conf/manifests/user.pp index cbcca5d..894f5e3 100644 --- a/modules/conf/manifests/user.pp +++ b/modules/conf/manifests/user.pp @@ -34,7 +34,6 @@ define conf::user($user=$name) { ], creates => "$home/.vimrc", require => [ - Class['cron'], Class['c_toolchain'], User[$user], Exec["git clone doy/conf for $user"], diff --git a/modules/cron/manifests/job.pp b/modules/cron/manifests/job.pp new file mode 100644 index 0000000..4f39287 --- /dev/null +++ b/modules/cron/manifests/job.pp @@ -0,0 +1,8 @@ +define cron::job($frequency, $source = undef, $content = undef) { + require cron + + file { "/etc/cron.${frequency}/${name}": + source => $source, + mode => '0755'; + } +} diff --git a/modules/locate/manifests/init.pp b/modules/locate/manifests/init.pp index 182e3b4..12d0d5b 100644 --- a/modules/locate/manifests/init.pp +++ b/modules/locate/manifests/init.pp @@ -1,18 +1,12 @@ class locate { - include cron - package { "mlocate": ensure => installed, } - file { - '/etc/cron.daily/updatedb': - source => 'puppet:///modules/locate/updatedb', - mode => '0755', - require => [ - Package['mlocate'], - Class['cron'], - ]; + cron::job { "updatedb": + frequency => "daily", + source => 'puppet:///modules/locate/updatedb', + require => Package['mlocate']; } exec { "initial updatedb run": diff --git a/modules/mail/manifests/mailu.pp b/modules/mail/manifests/mailu.pp index cd38e26..9297dd6 100644 --- a/modules/mail/manifests/mailu.pp +++ b/modules/mail/manifests/mailu.pp @@ -1,6 +1,5 @@ class mail::mailu { include mail::persistent - include cron include docker package { "opendkim": @@ -17,13 +16,12 @@ class mail::mailu { "/media/persistent/.env.common": source => "puppet:///modules/mail/mailu.env", require => Class["mail::persistent"]; - '/etc/cron.daily/learn_spam': - source => 'puppet:///modules/mail/learn_spam', - mode => '0755', - require => [ - Service['mailu'], - Class['cron'], - ]; + } + + cron::job { "learn_spam": + frequency => "daily", + source => 'puppet:///modules/mail/learn_spam', + require => Service['mailu']; } exec { "generate mailu secret key": diff --git a/modules/partofme/manifests/persistent.pp b/modules/partofme/manifests/persistent.pp index 57c5e5e..cc12447 100644 --- a/modules/partofme/manifests/persistent.pp +++ b/modules/partofme/manifests/persistent.pp @@ -1,20 +1,19 @@ class partofme::persistent { - include cron - file { "/media": ensure => directory; "/media/persistent": ensure => directory, require => File["/media"]; - "/etc/cron.weekly/raid-scrub": - source => 'puppet:///modules/partofme/raid-scrub', - mode => '0755', - require => Class['cron']; - "/etc/cron.hourly/raid-scrub-check": - source => 'puppet:///modules/partofme/raid-scrub-check', - mode => '0755', - require => Class['cron']; + } + + cron::job { + "raid-scrub": + frequency => "weekly", + source => 'puppet:///modules/partofme/raid-scrub'; + "raid-scrub-check": + frequency => "hourly", + source => 'puppet:///modules/partofme/raid-scrub-check'; } $fstab_line = "/dev/partofme/data /media/persistent ext4 rw,relatime,noauto 0 2" diff --git a/modules/tarsnap/manifests/init.pp b/modules/tarsnap/manifests/init.pp index a364dce..485daa7 100644 --- a/modules/tarsnap/manifests/init.pp +++ b/modules/tarsnap/manifests/init.pp @@ -1,6 +1,4 @@ class tarsnap($source=undef, $content=undef) { - include cron - package { 'tarsnap': ensure => installed; } @@ -16,14 +14,15 @@ class tarsnap($source=undef, $content=undef) { '/etc/acts.conf': source => $source, content => $content; - '/etc/cron.daily/acts': - source => 'puppet:///modules/tarsnap/acts', - mode => '0755', - require => [ - File['/etc/acts.conf'], - Package::Makepkg['acts'], - Class['cron'], - ]; + } + + cron::job { "acts": + frequency => "daily", + source => 'puppet:///modules/tarsnap/acts', + require => [ + File['/etc/acts.conf'], + Package::Makepkg['acts'], + ]; } secret { "/etc/tarsnap/machine-key": diff --git a/modules/tozt/manifests/metabase.pp b/modules/tozt/manifests/metabase.pp index 32e95f5..d3f6c66 100644 --- a/modules/tozt/manifests/metabase.pp +++ b/modules/tozt/manifests/metabase.pp @@ -34,16 +34,18 @@ class tozt::metabase { owner => 'doy', group => 'doy', require => Conf::User["doy"]; - "/etc/cron.hourly/metabase": - mode => '0755', - source => "puppet:///modules/tozt/metabase", - require => [ - Package::Cargo["ynab-export for doy"], - Exec["clone metabase-utils"], - Secret["/home/doy/.config/ynab/api-key"], - Secret["/home/doy/.config/google/investments-sheet"], - Exec["create money db"], - ]; + } + + cron::job { "metabase": + frequency => "hourly", + source => "puppet:///modules/tozt/metabase", + require => [ + Package::Cargo["ynab-export for doy"], + Exec["clone metabase-utils"], + Secret["/home/doy/.config/ynab/api-key"], + Secret["/home/doy/.config/google/investments-sheet"], + Exec["create money db"], + ]; } secret { "/home/doy/.config/ynab/api-key": |