Skip to content

Instantly share code, notes, and snippets.

@pulecp
pulecp / gist:9648e3ce736ec243c200
Created November 20, 2014 15:45
Classes Vs Defined Types
Classes Vs Defined Types
Classes are not to be thought of in the ‘object oriented’ meaning of a class. This means a machine belongs to a particular class of machine.
For instance, a generic webserver would be a class. You would include that class as part of any node that needed to be built as a generic webserver. That class would drop in whatever packages, etc, it needed to do.
Defined types on the other hand (created with ‘define’) can have many instances on a machine, and can encapsulate classes and other resources. They can be created using user supplied variables. For instance, to manage iptables, a defined type may wrap each rule in the iptables file, and the iptables configuration could be built out of fragments generated by those defined types.
Usage of classes and defined types, in addition to the built-in managed types, is very helpful towards having a managable Puppet infrastructure.
Flapjack::Diner.create_contact_notification_rules(
'0',
{
'regex_tags' => [ '^bacula$', '^job:$' ],
'time_restrictions' => [
{
'start_time' => '2013-01-28 18:00:00',
'end_time' => '2013-01-29 08:00:00',
'rrules' => [
{
#!/bin/bash
# I suppose that you have current data in /var/lib/carbon/whisper
# and data which you want to sync in /var/lib/carbon/var/lib/carbon/whisper
wget https://raw.githubusercontent.com/graphite-project/whisper/master/bin/whisper-fill.py
src_dir=`find /var/lib/carbon/var/lib/carbon/whisper -type f`
# list of severity levels
# ["emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug"]
cron { 'Clean_debug_older_than_4_weeks_28_days':
command => '/usr/local/bin/purge_elasticsearch.sh -d 28 -l debug',
minute => '10',
hour => '5',
}
cron { 'Clean_informational_older_than_16_weeks_112_days':
mount -t glusterfs [-o <options>] <server1>,<server2>,<server3>,..<serverN>:/<volname> <mount_point>
@pulecp
pulecp / bind - master
Created September 25, 2015 14:21
bind configuration with tsig keys
key "external" {
algorithm hmac-md5;
secret "TW97YPZWWdSJXd/yYisrrQ==";
};
key "internal" {
algorithm hmac-md5;
secret "msSGPzPfX8fAE3I4nE7pcw==";
};
@pulecp
pulecp / bind - master
Last active September 25, 2015 14:23
bind configuration with notifications by tsig keys
/etc/named.conf
key "external" {
algorithm hmac-md5;
secret "TW97YPZWWdSJXd/yYisrrQ==";
};
key "internal" {
algorithm hmac-md5;
secret "msSGPzPfX8fAE3I4nE7pcw==";
@pulecp
pulecp / redis-stats.php
Last active June 15, 2016 03:56 — forked from VerosK/redis-stats.php
Test redis status
<?php
/* Redis PHP stats dump
* Based on code https://gist.github.com/putzflorian/45c137a8d7868d4b6250
*/
define(REDIS_TIMEOUT, 2);
$fp = fsockopen('127.0.0.1', 6379, $errno, $errstr, REDIS_TIMEOUT);
if (!$fp) {
die($errstr);
}
@pulecp
pulecp / add-submodules.sh
Last active October 22, 2015 06:16
Add to submodules from another project with selection
#!/bin/bash
exec 3<submodules
while read -u 3 -r NAME;read -u 3 -r REPO
do
REPO_DIR=`echo $NAME|cut -d '"' -f2`
REPO_URL=`echo $REPO|cut -d '=' -f2`
[ -d $REPO_DIR ] && continue
@pulecp
pulecp / vips_install.sh
Last active May 18, 2016 14:40
How to install vips on Centos6
yum install intltool glib2-devel libxml2-devel libpng-devel libjpeg-devel libexif-devel libtiff-devel
mkdir -p /opt/vips/{lib,include}
################################
## INSTALL IMAGEMAGICK v6 !!! ##
################################
[ -d ImageMagick ] || git clone -b ImageMagick-6 https://github.com/ImageMagick/ImageMagick
cd ImageMagick