Version information
This version is compatible with:
- Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 4.7.0 < 6.0.0
- ,
Start using this module
Add this module to your Puppetfile:
mod 'puppetfinland-rsnapshot', '2.0.0'
Learn more about managing modules with a PuppetfileDocumentation
rsnapshot
A Puppet module for managing rsnapshot.
Module usage
First you need to create a public/private SSH keypair for rsnapshot, for example with 'ssh-keygen'. Then add the private and public key to Hiera. Then you can include the rsnapshot class and give it the parameters you want:
classes:
- rsnapshot
rsnapshot::private_key_content: 'your-private-key'
rsnapshot::snapshot_root: '/backup/rsnapshot'
rsnapshot::backups:
- '/etc/': 'backup.domain.com/'
- '/var/backups/local/': 'backup.domain.com/'
- 'root@server.domain.com:/etc/': 'server.domain.com/'
rsnapshot::retains:
- daily: 7
- weekly: 4
- monthly: 6
rsnapshot::crons:
daily:
minute: 0
hour: 10
weekly:
minute: 0
hour: 12
weekday: 3
monthly:
minute: 0
hour: 14
monthday: 1
Another example from a Puppet profile:
$private_key_content = lookup('profile::rsnapshot::private_key_content', String)
$backups = lookup('profile::rsnapshot::backups')
class { '::rsnapshot':
private_key_content => $private_key_content,
snapshot_root => '/var/backups/rsnapshot',
retains => [ { 'daily' => 7 }, { 'weekly' => 4 }, { 'monthly' => 7 }, ],
crons => { 'daily' => { 'minute' => 30, 'hour' => 6, },
'weekly' => { 'minute' => 30, 'hour' => 5, 'weekday' => 6 },
'monthly' => { 'minute' => 30, 'hour' => 4, 'monthday' => 1 }, },
backups => $backups,
}
The "backups" variable in Hiera would be in the same format as above, for example
rsnapshot::backups:
- '/etc/': 'backup.domain.com/'
- '/var/backups/local/': 'backup.domain.com/'
- 'root@server.domain.com:/etc/': 'server.domain.com/'
Note that the titles of the rsnapshot::cron resources need to match those given for retains in the main class - here "daily", "weekly" and "monthly". Also note that the "retain" parameters need to be determined in the correct order, or rsnapshot will start "eating" its own backups; the more frequent backups (e.g. "daily") should be defined earlier than and also run before the less frequent ones (e.g. "monthly). Aping the above configuration is probably the safest bet.
Use the rsnapshot::allow class to allow connections to hosts to be backed up:
classes:
- rsnapshot::allow
rsnapshot::allow::host: '10.122.49.4'
rsnapshot::allow::key: '<rsnapshot's public key as a string>'
The IP address is added to SSH authorized_keys options, so that the given key is only valid if the connection comes from the given host.
Finally run "rsnapshot daily" or such manually, and accept the SSH keys as needed. Later this manual procedure should be replaced with exported SSH host keys (sshkey type) that are collected on the rsnapshot host.
For more details on module usage refer to these source files:
Dependencies
- puppetfinland/os (>= 0.5.6)
- puppetlabs/stdlib (>= 4.0.0)
Copyright 2018 Samuli Seppänen, 2017 OpenVPN, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.