aboutsummaryrefslogtreecommitdiff
path: root/modules/etckeeper
diff options
context:
space:
mode:
Diffstat (limited to 'modules/etckeeper')
-rw-r--r--modules/etckeeper/files/additional_gitignore11
-rw-r--r--modules/etckeeper/manifests/init.pp31
-rw-r--r--modules/etckeeper/manifests/run.pp7
3 files changed, 49 insertions, 0 deletions
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}