aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/install_ovh.pp45
-rw-r--r--modules/etckeeper/files/additional_gitignore11
-rw-r--r--modules/etckeeper/manifests/init.pp31
-rw-r--r--modules/etckeeper/manifests/run.pp7
4 files changed, 90 insertions, 4 deletions
diff --git a/manifests/install_ovh.pp b/manifests/install_ovh.pp
index d1e109f..581e289 100644
--- a/manifests/install_ovh.pp
+++ b/manifests/install_ovh.pp
@@ -1,13 +1,50 @@
1node default { 1node default {
2 include stdlib 2 include stdlib
3 3
4 class { 'ovh_cleanup': } 4 stage { 'base_configuration':
5 class { 'base_packages': } 5 before => Stage['main']
6 class { 'locales': } 6 }
7 class { 'cron_puppet': } 7 stage { 'base_installation':
8 before => Stage['base_configuration']
9 }
10 stage { 'preparation':
11 before => Stage['base_installation']
12 }
13
14 class { 'etckeeper':
15 stage => 'preparation'
16 }
17 class { 'ovh_cleanup':
18 stage => 'preparation'
19 }
20 etckeeper::run { 'post_preparation_stage':
21 reason => "Post puppet preparation stage",
22 stages => [Stage['preparation']]
23 }
24
25 class { 'base_packages':
26 stage => "base_installation"
27 }
28 etckeeper::run { 'post_base_installation_stage':
29 reason => "Post puppet base installation stage",
30 stages => [Stage['base_installation']]
31 }
32
33 class { 'locales':
34 stage => "base_configuration"
35 }
36 class { 'cron_puppet':
37 stage => "base_configuration"
38 }
8 class { 'base_configuration': 39 class { 'base_configuration':
40 stage => "base_configuration",
9 hostname => 'new.immae.eu' 41 hostname => 'new.immae.eu'
10 } 42 }
43 etckeeper::run { 'post_base_configuration_stage':
44 reason => "Post puppet base configuration stage",
45 stages => [Stage['base_configuration']]
46 }
47
11 class { 'aur': } 48 class { 'aur': }
12 49
13 reboot { 'after_run': 50 reboot { 'after_run':
diff --git a/modules/etckeeper/files/additional_gitignore b/modules/etckeeper/files/additional_gitignore
new file mode 100644
index 0000000..5c6a485
--- /dev/null
+++ b/modules/etckeeper/files/additional_gitignore
@@ -0,0 +1,11 @@
1/ca-certificates/extracted/*
2/puppetlabs/*
3/pacman.d/gnupg/*
4!/pacman.d/gnupg/gpg.conf
5/ssl/certs/*
6/postfix/aliases.db
7/udev/hwdb.bin
8passwd-
9group-
10shadow-
11gshadow-
diff --git a/modules/etckeeper/manifests/init.pp b/modules/etckeeper/manifests/init.pp
new file mode 100644
index 0000000..d7039a2
--- /dev/null
+++ b/modules/etckeeper/manifests/init.pp
@@ -0,0 +1,31 @@
1class etckeeper {
2 ensure_packages('etckeeper')
3
4 exec { 'etckeeper-gitignore':
5 environment => ['VCS=git', 'LOWLEVEL_PACKAGE_MANAGER=pacman'],
6 path => '/usr/bin',
7 command => 'mkdir -p /tmp/etckeeper/.git && cd /tmp/etckeeper && /etc/etckeeper/update-ignore.d/01update-ignore && cp /tmp/etckeeper/.gitignore /etc/.gitignore_etckeeper && rm -r /tmp/etckeeper/',
8 cwd => '/tmp',
9 creates => '/etc/.gitignore_etckeeper'
10 }
11
12 file { 'etckeeper-additional_gitignore':
13 source => 'puppet:///modules/etckeeper/additional_gitignore',
14 path => '/etc/.gitignore_additional'
15 }
16
17 exec { 'etckeeper-concat_files':
18 path => '/usr/bin',
19 command => 'cat /etc/.gitignore_etckeeper /etc/.gitignore_additional > /etc/.gitignore',
20 refreshonly => true,
21 subscribe => [Exec['etckeeper-gitignore'], File['etckeeper-additional_gitignore']]
22 }
23
24 exec { 'etckeeper-init':
25 command => 'etckeeper init',
26 path => '/usr/bin',
27 cwd => '/etc',
28 creates => '/etc/.git'
29 }
30
31}
diff --git a/modules/etckeeper/manifests/run.pp b/modules/etckeeper/manifests/run.pp
new file mode 100644
index 0000000..ddbb4e1
--- /dev/null
+++ b/modules/etckeeper/manifests/run.pp
@@ -0,0 +1,7 @@
1define etckeeper::run ($stages = [Stage['main']], $refreshonly = true, $reason = 'puppet run') {
2 exec { "etckeeper::run::${name}":
3 refreshonly => $refreshonly,
4 command => "/usr/bin/etckeeper commit '${reason}' || true",
5 subscribe => $stages
6 }
7}