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 'arden-vios_backup', '0.1.0'
Learn more about managing modules with a PuppetfileDocumentation
vios_backup
Table of Contents
- Description
- Setup - The basics of getting started with vios_backup
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
This module configures a machine to remotely backup, retrieve, and then retain virtual and logical configuration backups from IBM Virtual I/O Servers (VIOS) in a PowerVM environment.
These are config-only backups performed using the viosbr command. Note that there may be cases which necessitate backupios
- this module does not support those forms of backups.
Setup
What vios_backup affects
This module changes the following components
- Script Creation - A backup script will be created in
/usr/local/bin
which will be used to execute the backup - User Creation - The specified user is created with the provided SSH private and public keys
- Cron Job - One job will be scheduled to execute the overall backup process
- Backup Directory - The target directory will be created
During the backup, an entry will be posted to the user
syslog facility with either an info
level for a success message or a err
message for any kind of failure. Each entry will be tagged vios_backup
.
Setup Requirements
Backup User & Group
It is assumed that the specified backup user and group are created on the target machine prior to the application of this module.
SSH Public Key Deployment
The public key provided during the configuration of this module must be added to the authorized keys file for each VIOS backed up by this instance.
-
Transfer a copy of your public key to the target server
VIOS="power1-vio0.example.org" PUBLIC_KEY="${HOME}/.ssh/id_rsa.pub" scp "${PUBLIC_KEY}" "padmin@${VIOS}:/tmp/"
-
Log on to the VIOS and exit the restricted shell.
ssh "padmin@${VIOS}" oem_setup_env
-
Append the contents of your key to padmin's authorized_keys file.
KEY_FILE="/tmp/id_rsa.pub" cat "${KEY_FILE}" >> /home/padmin/.ssh/authorized_keys
Required Applications
Nothing crazy:
/bin/logger
- needed to append messages to the syslog/bin/sh
- the backup script is written targeting the borne shell/bin/ssh
- we need ssh to communicate with the VIOS
Beginning with vios_backup
Once the setup requirements are met, simply declare the class with all required parameters and you're good to go.
Usage
At the moment, all parameters are mandatory. Here's a standard example:
class { 'vios_backup':
user => 'padmin',
group => 'backup',
base_directory => '/srv/backup/vios',
days_retention => 90,
target_vios => [ 'host1-vio0.example.com', 'host1-vio1.example.com' ],
cron_job => {
hour => '1',
minute => '45',
weekday => '0',
}
}
In the example above, two vio servers are backed up each week on Sunday at 1:45. After about two weeks of execution the directory may look similar to the following:
/srv/backup/vios
|-- host1-vio0.example.com
| |-- 2018-12-02_0145.06.tar.gz
| `-- 2018-12-09_0145.02.tar.gz
`-- host1-vio1.example.com
|-- 2018-12-02_0145.26.tar.gz
`-- 2018-12-09_0145.36.tar.gz
Reference
Limitations
- This has only been tested with VIOS 2.2.6.x - Assuming the viosbr command exists and works, this should work on all subsequent VIOS versions.
Development
Submit a pull request.
Contributors
Check out the contributor list
Reference
Table of Contents
Classes
vios_backup
: Configures remote backups of VIOS servers to the specified local disk repository.vios_backup::config
: Creates a cron entry scheduling the VIOS backups.vios_backup::install
: Creates the backup directory structure and installs the script.vios_backup::params
: Declare constants used within this module.
Classes
vios_backup
Performs config backups of a list of VIOS servers via passwordless SSH. This is accomplished using the viosbr command on each machine.
Examples
Daily backup of two VIOS with 14 days retention
class { 'vios_backup':
user => 'backup',
group => 'backup',
base_directory => '/srv/backup/vios',
days_retention => 14,
target_vios => [ 'vio0.example.com', 'vio1.example.com' ],
cron_job => {
hour => '0',
minute => '30',
},
}
Parameters
The following parameters are available in the vios_backup
class.
user
Data type: String
Name of the local user who will own the backup files and run the scheduled cron job.
Default value: undef
group
Data type: String
Name of the local group which will be set on the backup directories.
Default value: undef
base_directory
Data type: Stdlib::Absolutepath
The root directory in which each vios backup will be stored. Note that this must be an absolute path!
Default value: undef
days_retention
Data type: Integer
Number of days to retain backups both on each VIOS and on the backup server. Any backups older than this will be automatically deleted when the job executes.
Default value: undef
target_vios
Data type: Array[Stdlib::Fqdn]
Array of DNS names of VIOS which should be backed up. Currently all VIOS are
processed on the same schedule. Each entry specified here will generate a
subdirectory in $base_directory
containing the backup files.
Default value: undef
cron_job
Data type: Hash[String, Variant[String, Integer, Array]]
Specification of a cron resource that excludes the command and user. The backup will be scheduled at the frequency specified in this structure.
Default value: undef
vios_backup::config
Schedules the backup job as specified in the main class
vios_backup::install
Performs preliminary setup needed for the operation of the backups on a given host. Note that the existence of the backup user and group is assumed.
vios_backup::params
Declares constants used within this module.
Parameters
The following parameters are available in the vios_backup::params
class.
local_bin
Data type: Stdlib::Absolutepath
Path to the local binary directory on this host. For most operating
systems the value is /usr/local/bin
Default value: undef
Dependencies
- puppetlabs/stdlib (>= 4.25.1 < 6.0.0)