UNPKG

code-example

Version:
9 lines (8 loc) 2.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var code = "# == Class: automysqlbackup\n#\n# Puppet module to install AutoMySQLBackup for periodic MySQL backups.\n#\n# class { 'automysqlbackup':\n# backup_dir => '/mnt/backups',\n# }\n#\n\nclass automysqlbackup (\n $bin_dir = $automysqlbackup::params::bin_dir,\n $etc_dir = $automysqlbackup::params::etc_dir,\n $backup_dir = $automysqlbackup::params::backup_dir,\n $install_multicore = undef,\n $config = {},\n $config_defaults = {},\n) inherits automysqlbackup::params {\n\n# Ensure valid paths are assigned\n validate_absolute_path($bin_dir)\n validate_absolute_path($etc_dir)\n validate_absolute_path($backup_dir)\n\n# Create a subdirectory in /etc for config files\n file { $etc_dir:\n ensure => directory,\n owner => 'root',\n group => 'root',\n mode => '0750',\n }\n\n# Create an example backup file, useful for reference\n file { \"${etc_dir}/automysqlbackup.conf.example\":\n ensure => file,\n owner => 'root',\n group => 'root',\n mode => '0660',\n source => 'puppet:///modules/automysqlbackup/automysqlbackup.conf',\n }\n\n# Add files from the developer\n file { \"${etc_dir}/AMB_README\":\n ensure => file,\n source => 'puppet:///modules/automysqlbackup/AMB_README',\n }\n file { \"${etc_dir}/AMB_LICENSE\":\n ensure => file,\n source => 'puppet:///modules/automysqlbackup/AMB_LICENSE',\n }\n\n# Install the actual binary file\n file { \"${bin_dir}/automysqlbackup\":\n ensure => file,\n owner => 'root',\n group => 'root',\n mode => '0755',\n source => 'puppet:///modules/automysqlbackup/automysqlbackup',\n }\n\n# Create the base backup directory\n file { $backup_dir:\n ensure => directory,\n owner => 'root',\n group => 'root',\n mode => '0755',\n }\n\n# If you'd like to keep your config in hiera and pass it to this class\n if !empty($config) {\n create_resources('automysqlbackup::backup', $config, $config_defaults)\n }\n\n# If using RedHat family, must have the RPMforge repo's enabled\n if $install_multicore {\n package { ['pigz', 'pbzip2']: ensure => installed }\n }\n\n}\n\n"; var _default = code; exports.default = _default;