aboutsummaryrefslogtreecommitdiff
path: root/modules/etckeeper
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-11 01:13:22 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-11 02:53:50 +0200
commitcbb2c25bf2f71c7840bd599739e8d2569b159c8a (patch)
tree581d0858d98669f19811f8d4b1ce1a07e0498bee /modules/etckeeper
parent7a7f654494ce996d3abd2c753b98883da8d3d875 (diff)
downloadPuppet-cbb2c25bf2f71c7840bd599739e8d2569b159c8a.tar.gz
Puppet-cbb2c25bf2f71c7840bd599739e8d2569b159c8a.tar.zst
Puppet-cbb2c25bf2f71c7840bd599739e8d2569b159c8a.zip
Add etckeeper
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}