]> gitweb.fluxo.info Git - puppet-backupninja.git/commitdiff
add a sys backupninja module piece
authorMicah Anderson <micah@riseup.net>
Sat, 17 May 2008 23:31:41 +0000 (23:31 +0000)
committerMicah Anderson <micah@riseup.net>
Sat, 17 May 2008 23:31:41 +0000 (23:31 +0000)
manifests/sys.pp [new file with mode: 0644]
templates/sys.conf.erb [new file with mode: 0644]

diff --git a/manifests/sys.pp b/manifests/sys.pp
new file mode 100644 (file)
index 0000000..4829a15
--- /dev/null
@@ -0,0 +1,33 @@
+# sys handler, as part of a backupninja run.
+#
+# Valid attributes for this type are:
+#
+#   order: The prefix to give to the handler config filename, to set
+#      order in which the actions are executed during the backup run.
+#
+#   ensure: Allows you to delete an entry if you don't want it any more
+#      (but be sure to keep the configdir, name, and order the same, so
+#      that we can find the correct file to remove).
+#
+# 
+define backupninja::sys($order = 30,
+                           $ensure = present,
+                           $parentdir = '/var/backups',
+                           $packages = yes,
+                           $packagesfile = '/var/backups/dpkg-selections.txt',
+                           $partitions = yes,
+                           $partitionsfile = '/var/backups/partitions.__star__.txt',
+                           $dosfdisk = yes,
+                           $hardware = yes,
+                           $hardwarefile = '/var/backups/hardware.txt',
+                           $dohwinfo = yes,
+                          ) {
+       file { "${backupninja::client::configdir}/${order}_${name}.sys":
+               ensure => $ensure,
+               content => template('backupninja/sys.conf.erb'),
+               owner => root,
+               group => root,
+               mode => 0600,
+               require => File["${backupninja::client::configdir}"]
+       }
+}
diff --git a/templates/sys.conf.erb b/templates/sys.conf.erb
new file mode 100644 (file)
index 0000000..b0ae623
--- /dev/null
@@ -0,0 +1,16 @@
+# This configuration file was auto-generated by the Puppet configuration
+# management system.  Any changes you make to this file will be overwritten
+# the next time Puppet runs.  Please make configuration changes to this
+# service in Puppet.
+
+<% %w{parentdir packagesfile partitionsfile hardwarefile}.each do |v|
+       if send(v)
+               -%><%= v + ' = ' + send(v) + "\n" %><%
+       end
+end -%>
+
+packages = <%= packages ? 'yes' : 'no' %>
+partitions = <%= partitions ? 'yes' : 'no' %>
+dosfdisk = <%= dosfdisk ? 'yes' : 'no' %>
+hardware = <%= hardware ? 'yes' : 'no' %>
+dohwinfo = <%= dohwinfo ? 'yes' : 'no' %>