-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
t0xicCode
committed
Apr 15, 2015
0 parents
commit 175deb7
Showing
18 changed files
with
721 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fixtures: | ||
repositories: | ||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" | ||
symlinks: | ||
"rsnapshot": "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.bundle/ | ||
/vendor/ | ||
/pkg/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
source 'https://rubygems.org' | ||
|
||
def location_for(place, fake_version = nil) | ||
if place =~ /^(git[:@][^#]*)#(.*)/ | ||
[fake_version, { :git => $1, :branch => $2, :require => false }].compact | ||
elsif place =~ /^file:\/\/(.*)/ | ||
['>= 0', { :path => File.expand_path($1), :require => false }] | ||
else | ||
[place, { :require => false }] | ||
end | ||
end | ||
|
||
group :development, :unit_tests do | ||
gem 'rake', '~> 10.1.0', :require => false | ||
gem 'rspec', '~> 3.1.0', :require => false | ||
gem 'rspec-puppet', :require => false | ||
gem 'puppetlabs_spec_helper', :require => false | ||
gem 'puppet-lint', '< 1.1.0', :require => false | ||
gem 'metadata-json-lint', :require => false | ||
gem 'pry', :require => false | ||
gem 'simplecov', :require => false | ||
end | ||
|
||
facterversion = ENV['GEM_FACTER_VERSION'] || ENV['FACTER_GEM_VERSION'] | ||
if facterversion | ||
gem 'facter', *location_for(facterversion) | ||
else | ||
gem 'facter', :require => false | ||
end | ||
|
||
puppetversion = ENV['GEM_PUPPET_VERSION'] || ENV['PUPPET_GEM_VERSION'] | ||
if puppetversion | ||
gem 'puppet', *location_for(puppetversion) | ||
else | ||
gem 'puppet', :require => false | ||
end | ||
|
||
# vim:ft=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
CFPropertyList (2.2.8) | ||
coderay (1.1.0) | ||
diff-lcs (1.2.5) | ||
docile (1.1.5) | ||
facter (2.4.3) | ||
CFPropertyList (~> 2.2.6) | ||
hiera (1.3.4) | ||
json_pure | ||
json (1.8.2) | ||
json_pure (1.8.2) | ||
metaclass (0.0.4) | ||
metadata-json-lint (0.0.6) | ||
json | ||
spdx-licenses (~> 1.0) | ||
method_source (0.8.2) | ||
mocha (1.1.0) | ||
metaclass (~> 0.0.1) | ||
multi_json (1.11.0) | ||
pry (0.10.1) | ||
coderay (~> 1.1.0) | ||
method_source (~> 0.8.1) | ||
slop (~> 3.4) | ||
puppet (3.7.5) | ||
facter (> 1.6, < 3) | ||
hiera (~> 1.0) | ||
json_pure | ||
puppet-lint (1.0.1) | ||
puppet-syntax (2.0.0) | ||
rake | ||
puppetlabs_spec_helper (0.10.1) | ||
mocha | ||
puppet-lint | ||
puppet-syntax | ||
rake | ||
rspec-puppet | ||
rake (10.1.1) | ||
rspec (3.1.0) | ||
rspec-core (~> 3.1.0) | ||
rspec-expectations (~> 3.1.0) | ||
rspec-mocks (~> 3.1.0) | ||
rspec-core (3.1.7) | ||
rspec-support (~> 3.1.0) | ||
rspec-expectations (3.1.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.1.0) | ||
rspec-mocks (3.1.3) | ||
rspec-support (~> 3.1.0) | ||
rspec-puppet (2.0.1) | ||
rspec | ||
rspec-support (3.1.2) | ||
simplecov (0.9.2) | ||
docile (~> 1.1.0) | ||
multi_json (~> 1.0) | ||
simplecov-html (~> 0.9.0) | ||
simplecov-html (0.9.0) | ||
slop (3.6.0) | ||
spdx-licenses (1.0.0) | ||
json | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
facter | ||
metadata-json-lint | ||
pry | ||
puppet | ||
puppet-lint (< 1.1.0) | ||
puppetlabs_spec_helper | ||
rake (~> 10.1.0) | ||
rspec (~> 3.1.0) | ||
rspec-puppet | ||
simplecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# rsnapshot | ||
|
||
#### Table of Contents | ||
|
||
1. [Overview](#overview) | ||
2. [Module Description - What the module does and why it is useful](#module-description) | ||
3. [Setup - The basics of getting started with rsnapshot](#setup) | ||
* [What rsnapshot affects](#what-rsnapshot-affects) | ||
* [Beginning with rsnapshot](#beginning-with-rsnapshot) | ||
4. [Usage - Configuration options and additional functionality](#usage) | ||
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) | ||
5. [Limitations - OS compatibility, etc.](#limitations) | ||
6. [Development - Guide for contributing to the module](#development) | ||
|
||
## Overview | ||
|
||
This puppet module manages rsnapshot configuration. It's a barebones module, as it doesn't deal with managing ssh keys or cron rules to trigger rsnapshot. | ||
|
||
At the moment, this module has been tested with Puppet 3.x and Ubuntu 12.04, 14.04 and Debian 6. If you have another OS/Puppet version you want to include, please submit a pull request! | ||
|
||
## Module Description | ||
|
||
This module is a barebones rsnapshot installation and configuration system. It came into existing because we needed an rsnapshot module but didn't want to have it generate cron rules or setup ssh keys (rsnapshot only needs to generate local backups for us). | ||
|
||
It is relatively trivial to then add a `cron` rule to trigger rsnapshot, and managing ssh keys can be done through `ssh_authorized_key`. | ||
|
||
## Setup | ||
|
||
### What rsnapshot affects | ||
|
||
* `rsnapshot` package and its dependencies | ||
* `/etc/rsnapshot.conf` (by default) | ||
|
||
### Beginning with rsnapshot | ||
|
||
At the base minimum, you should add a hash of | ||
The very basic steps needed for a user to get the module up and running. | ||
|
||
If your most recent release breaks compatibility or requires particular steps | ||
for upgrading, you may wish to include an additional section here: Upgrading | ||
(For an example, see http://forge.puppetlabs.com/puppetlabs/firewall). | ||
|
||
## Usage | ||
|
||
You only need to declare the rsnapshot class, and configure the parameters you need. | ||
The class will default to sane values for your OS if you don't override some parameters. | ||
|
||
While you can include the class as is, it wont be useful unless you specify `backups` or `backup_scripts`. | ||
|
||
## Reference | ||
|
||
### backups | ||
A hash backup locations. The key is the source, the value is the destination. | ||
|
||
``` | ||
class { 'rsnapshot': | ||
backups => { | ||
'/home/' => 'localhost/', | ||
} | ||
} | ||
``` | ||
|
||
If you want the backup stanza to have overriden configuration options, add them to the destination, separated by a tab character: | ||
|
||
``` | ||
class { 'rsnapshot': | ||
backups => { | ||
'/home/' => 'localhost/ one_fs=1', | ||
} | ||
} | ||
``` | ||
|
||
### backup_scripts | ||
Exactly like [backups](#backups), except that they generate `backup_script` stanzas. | ||
|
||
## Limitations | ||
|
||
The module has been tested/used in production with Puppet 3.x. | ||
|
||
On the OS side, the module currently only works on Debian-family OSes, but we'd love to get a patch to add support for more families/operating systems. | ||
|
||
## Development | ||
|
||
Development is happening on [github](https://github.com/OpenConceptConsulting/puppet-rsnapshot), and we welcome pull requests! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'rubygems' | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
PuppetLint.configuration.send('disable_80chars') | ||
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] | ||
|
||
desc "Validate manifests, templates, and ruby files" | ||
task :validate do | ||
Dir['manifests/**/*.pp'].each do |manifest| | ||
sh "puppet parser validate --noop #{manifest}" | ||
end | ||
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file| | ||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ | ||
end | ||
Dir['templates/**/*.erb'].each do |template| | ||
sh "erb -P -x -T '-' #{template} | ruby -c" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# == Class: rsnapshot::config | ||
# | ||
# Manages the rsnapshot configuration file | ||
class rsnapshot::config inherits rsnapshot { | ||
|
||
$no_create_root_num = bool2num($rsnapshot::no_create_root) | ||
$stop_on_stale_lockfile_num = bool2num($rsnapshot::stop_on_stale_lockfile) | ||
$one_fs_num = bool2num($rsnapshot::one_fs) | ||
$link_dest_num = bool2num($rsnapshot::link_dest) | ||
$sync_first_num = bool2num($rsnapshot::sync_first) | ||
$use_lazy_deletes_num = bool2num($rsnapshot::use_lazy_deletes) | ||
|
||
file { $rsnapshot::config: | ||
ensure => file, | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0644', | ||
content => template('rsnapshot/rsnapshot.erb') | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# == Class: rsnapshot | ||
# | ||
# Manages rsnapshot. | ||
# | ||
# === Parameters | ||
# | ||
class rsnapshot ( | ||
$package_name = $rsnapshot::params::package_name, | ||
$package_ensure = $rsnapshot::params::package_ensure, | ||
$config = $rsnapshot::params::config, | ||
$logfile = $rsnapshot::params::logfile, | ||
$lockfile = $rsnapshot::params::lockfile, | ||
$config_version = $rsnapshot::params::config_version, | ||
$snapshot_root = $rsnapshot::params::snapshot_root, | ||
$cmd_cp = $rsnapshot::params::cmd_cp, | ||
$cmd_rm = $rsnapshot::params::cmd_rm, | ||
$cmd_rsync = $rsnapshot::params::cmd_rsync, | ||
$cmd_ssh = $rsnapshot::params::cmd_ssh, | ||
$cmd_logger = $rsnapshot::params::cmd_logger, | ||
$cmd_du = $rsnapshot::params::cmd_du, | ||
$cmd_rsnapshot_diff = $rsnapshot::params::cmd_rsnapshot_diff, | ||
$cmd_preexec = undef, | ||
$cmd_postexec = undef, | ||
$use_lvm = false, | ||
$linux_lvm_cmd_lvcreate = $rsnapshot::params::linux_lvm_cmd_lvcreate, | ||
$linux_lvm_cmd_lvremove = $rsnapshot::params::linux_lvm_cmd_lvremove, | ||
$linux_lvm_cmd_mount = $rsnapshot::params::linux_lvm_cmd_mount, | ||
$linux_lvm_cmd_umount = $rsnapshot::params::linux_lvm_cmd_umount, | ||
$linux_lvm_snapshotsize = $rsnapshot::params::linux_lvm_snapshotsize, | ||
$linux_lvm_snapshotname = $rsnapshot::params::linux_lvm_snapshotname, | ||
$linux_lvm_vgpath = $rsnapshot::params::linux_lvm_vgpath, | ||
$linux_lvm_mountpath = $rsnapshot::params::linux_lvm_mountpath, | ||
$snapshot_root = $rsnapshot::params::snapshot_root, | ||
$no_create_root = $rsnapshot::params::no_create_root, | ||
$verbose_level = $rsnapshot::params::verbose_level, | ||
$log_level = $rsnapshot::params::log_level, | ||
$stop_on_stale_lockfile = $rsnapshot::params::stop_on_stale_lockfile, | ||
$rsync_short_args = $rsnapshot::params::rsync_short_args, | ||
$rsync_long_args = $rsnapshot::params::rsync_long_args, | ||
$ssh_args = $rsnapshot::params::ssh_args, | ||
$du_args = $rsnapshot::params::du_args, | ||
$one_fs = $rsnapshot::params::one_fs, | ||
$retain = $rsnapshot::params::retain, | ||
$include = $rsnapshot::params::include, | ||
$exclude = $rsnapshot::params::exclude, | ||
$include_file = $rsnapshot::params::include_file, | ||
$exclude_file = $rsnapshot::params::exclude_file, | ||
$link_dest = $rsnapshot::params::link_dest, | ||
$sync_first = $rsnapshot::params::sync_first, | ||
$rsync_numtries = $rsnapshot::params::rsync_numtries, | ||
$use_lazy_deletes = $rsnapshot::params::use_lazy_deletes, | ||
$backups = $rsnapshot::params::backups, | ||
$backup_scripts = $rsnapshot::params::backup_scripts, | ||
) inherits rsnapshot::params { | ||
|
||
anchor { 'rsnapshot::begin': } -> | ||
class { 'rsnapshot::install': } -> | ||
class { 'rsnapshot::config': } -> | ||
anchor { 'rsnapshot::end': } | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# == Class: rsnapshot::install | ||
# | ||
# Installs the rsnapshot package. | ||
class rsnapshot::install inherits rsnapshot { | ||
|
||
package { $rsnapshot::package_name: | ||
ensure => $rsnapshot::package_ensure, | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.