diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-26 00:41:55 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-26 01:19:39 +0200 |
commit | 2859008efe8f0a75344c7ba1c9c6e4d589f92da3 (patch) | |
tree | bb48fa503b6b1e01f9216d9e1729e1ba26adacf5 /modules/base_installation | |
parent | 7f1244c8c2a418ed9e978f098c73f8697e2cd306 (diff) | |
download | Puppet-2859008efe8f0a75344c7ba1c9c6e4d589f92da3.tar.gz Puppet-2859008efe8f0a75344c7ba1c9c6e4d589f92da3.tar.zst Puppet-2859008efe8f0a75344c7ba1c9c6e4d589f92da3.zip |
Use external module for cronjobs
Diffstat (limited to 'modules/base_installation')
-rw-r--r-- | modules/base_installation/manifests/cleanup.pp | 20 | ||||
-rw-r--r-- | modules/base_installation/manifests/cronie.pp | 54 | ||||
-rw-r--r-- | modules/base_installation/manifests/init.pp | 1 |
3 files changed, 52 insertions, 23 deletions
diff --git a/modules/base_installation/manifests/cleanup.pp b/modules/base_installation/manifests/cleanup.pp new file mode 100644 index 0000000..96aaa6b --- /dev/null +++ b/modules/base_installation/manifests/cleanup.pp | |||
@@ -0,0 +1,20 @@ | |||
1 | class base_installation::cleanup inherits base_installation { | ||
2 | # This class contains temporary classes used to cleanup old stuff | ||
3 | # after refactoring | ||
4 | |||
5 | cron { "puppet-pull-apply": | ||
6 | ensure => absent; | ||
7 | "puppet-apply": | ||
8 | ensure => absent; | ||
9 | "puppet-apply-reboot": | ||
10 | ensure => absent; | ||
11 | "pacman_keys": | ||
12 | ensure => absent; | ||
13 | "backup": | ||
14 | ensure => absent; | ||
15 | "py-cryptoportfolio-before": | ||
16 | ensure => absent; | ||
17 | "py-cryptoportfolio-after": | ||
18 | ensure => absent; | ||
19 | } | ||
20 | } | ||
diff --git a/modules/base_installation/manifests/cronie.pp b/modules/base_installation/manifests/cronie.pp index 2235470..3558d9f 100644 --- a/modules/base_installation/manifests/cronie.pp +++ b/modules/base_installation/manifests/cronie.pp | |||
@@ -10,31 +10,39 @@ class base_installation::cronie inherits base_installation { | |||
10 | owner => root, | 10 | owner => root, |
11 | group => root, | 11 | group => root, |
12 | } | 12 | } |
13 | cron { 'puppet-pull-apply': | 13 | cron::job { 'puppet-pull-apply': |
14 | ensure => present, | 14 | ensure => present, |
15 | command => "cd $base_installation::puppet_code_path ; /usr/bin/git pull", | 15 | command => "cd $base_installation::puppet_code_path ; /usr/bin/git pull", |
16 | user => root, | 16 | user => root, |
17 | minute => '*/30', | 17 | minute => '15,45', |
18 | require => File['post-hook'], | 18 | require => File['post-hook'], |
19 | description => "Pull git and apply puppet changes", | ||
19 | } | 20 | } |
20 | cron { 'puppet-apply': | 21 | cron::job::multiple { 'puppet-apply': |
21 | ensure => present, | 22 | ensure => present, |
22 | command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp", | 23 | jobs => [ |
23 | user => root, | 24 | { |
24 | minute => '*/20' | 25 | command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp", |
26 | user => root, | ||
27 | minute => '*/20', | ||
28 | description => "Re-apply puppet changes regularly", | ||
29 | }, | ||
30 | { | ||
31 | command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp", | ||
32 | user => root, | ||
33 | special => "reboot", | ||
34 | description => "Re-apply puppet changes at reboot", | ||
35 | } | ||
36 | ] | ||
25 | } | 37 | } |
26 | cron { 'puppet-apply-reboot': | 38 | |
27 | ensure => present, | 39 | cron::daily { 'pacman_keys': |
28 | command => "cd $base_installation::puppet_code_path ; /usr/local/sbin/puppet_apply $base_installation::puppet_code_path/manifests/site.pp", | 40 | ensure => present, |
29 | user => root, | 41 | command => "pacman-key --populate archlinux", |
30 | special => "reboot" | 42 | user => root, |
31 | } | 43 | minute => "0", |
32 | cron { 'pacman_keys': | 44 | hour => "1", |
33 | ensure => present, | 45 | description => "Populate pacman keys", |
34 | command => "pacman-key --populate archlinux", | ||
35 | user => root, | ||
36 | minute => "0", | ||
37 | hour => "1", | ||
38 | } | 46 | } |
39 | } | 47 | } |
40 | } | 48 | } |
diff --git a/modules/base_installation/manifests/init.pp b/modules/base_installation/manifests/init.pp index 998f8ff..d8abcaf 100644 --- a/modules/base_installation/manifests/init.pp +++ b/modules/base_installation/manifests/init.pp | |||
@@ -30,4 +30,5 @@ class base_installation ( | |||
30 | contain ::base_installation::users | 30 | contain ::base_installation::users |
31 | contain ::base_installation::package_managers | 31 | contain ::base_installation::package_managers |
32 | contain ::base_installation::puppet | 32 | contain ::base_installation::puppet |
33 | contain ::base_installation::cleanup | ||
33 | } | 34 | } |