[submodule "modules/ssl"]
path = modules/ssl
url = git://git.immae.eu/github/fnerdwq/puppet-ssl
+[submodule "modules/cron"]
+ path = modules/cron
+ url = git://git.immae.eu/github/voxpupuli/puppet-cron
--- /dev/null
+class base_installation::cleanup inherits base_installation {
+ # This class contains temporary classes used to cleanup old stuff
+ # after refactoring
+
+ cron { "puppet-pull-apply":
+ ensure => absent;
+ "puppet-apply":
+ ensure => absent;
+ "puppet-apply-reboot":
+ ensure => absent;
+ "pacman_keys":
+ ensure => absent;
+ "backup":
+ ensure => absent;
+ "py-cryptoportfolio-before":
+ ensure => absent;
+ "py-cryptoportfolio-after":
+ ensure => absent;
+ }
+}
owner => root,
group => root,
}
- cron { 'puppet-pull-apply':
- ensure => present,
- command => "cd $base_installation::puppet_code_path ; /usr/bin/git pull",
- user => root,
- minute => '*/30',
- require => File['post-hook'],
+ cron::job { 'puppet-pull-apply':
+ ensure => present,
+ command => "cd $base_installation::puppet_code_path ; /usr/bin/git pull",
+ user => root,
+ minute => '15,45',
+ require => File['post-hook'],
+ description => "Pull git and apply puppet changes",
}
- cron { 'puppet-apply':
- ensure => present,
- command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
- user => root,
- minute => '*/20'
+ cron::job::multiple { 'puppet-apply':
+ ensure => present,
+ jobs => [
+ {
+ command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
+ user => root,
+ minute => '*/20',
+ description => "Re-apply puppet changes regularly",
+ },
+ {
+ command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
+ user => root,
+ special => "reboot",
+ description => "Re-apply puppet changes at reboot",
+ }
+ ]
}
- cron { 'puppet-apply-reboot':
- ensure => present,
- command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
- user => root,
- special => "reboot"
- }
- cron { 'pacman_keys':
- ensure => present,
- command => "pacman-key --populate archlinux",
- user => root,
- minute => "0",
- hour => "1",
+
+ cron::daily { 'pacman_keys':
+ ensure => present,
+ command => "pacman-key --populate archlinux",
+ user => root,
+ minute => "0",
+ hour => "1",
+ description => "Populate pacman keys",
}
}
}
contain ::base_installation::users
contain ::base_installation::package_managers
contain ::base_installation::puppet
+ contain ::base_installation::cleanup
}
--- /dev/null
+Subproject commit d90d9be088ad5008018ada87c30ceb314a46ed77
mode => "0755",
}
- cron { "backup":
+ cron::job { "backup":
ensure => present,
command => $backup_script,
user => $user,
refreshonly => true,
before => [
File[$cf_bot_app_conf],
- Cron["py-cryptoportfolio-before"],
- Cron["py-cryptoportfolio-after"],
+ Cron::Job::Multiple["py-cryptoportfolio"],
]
}
],
}
- cron { "py-cryptoportfolio-before":
+ cron::job::multiple { "py-cryptoportfolio":
ensure => present,
- command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --before",
- user => $user,
- weekday => 7, # Sunday
- hour => 22,
- minute => 30,
environment => ["HOME=${home}","PATH=/usr/bin/","CRON_TZ=UTC"],
require => [
File[$cf_bot_app_conf],
Archive["${home}/trader_${bot_version}.tar.gz"]
],
- }
-
- cron { "py-cryptoportfolio-after":
- ensure => present,
- command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --after",
- user => $user,
- weekday => 1, # Monday
- hour => 0,
- minute => 0,
- environment => ["HOME=${home}","PATH=/usr/bin/","CRON_TZ=UTC"],
- require => [
- File[$cf_bot_app_conf],
- Archive["${home}/trader_${bot_version}.tar.gz"]
+ jobs => [
+ {
+ command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --before",
+ user => $user,
+ weekday => 7, # Sunday
+ hour => 22,
+ minute => 30,
+ description => "Run before the cryptoportfolio update",
+ },
+ {
+ command => "cd $cf_bot_app ; python main.py --quiet --config $cf_bot_app_conf --after",
+ user => $user,
+ weekday => 1, # Monday
+ hour => 0,
+ minute => 0,
+ description => "Run after the cryptoportfolio update",
+ }
],
}