Skip to content

Instantly share code, notes, and snippets.

View binford2k's full-sized avatar

Ben Ford binford2k

View GitHub Profile
# This is terrible practice. Instead, you should set up a repo locally and build packages
# to drop in there. RPM and deb files are approaching trivial to make unless you need to
# customize them heavily.
exec { 'build nginx': # just a name
command => "tar -xvzf $file; cd $dir; make; make install", # build & install the package
onlyif => "wget $url", # but only if the download succeeds
creates => '/path/to/installed/nginx', # and only if the installed file doesn't already exist
cwd => '/tmp',
path => '/usr/bin:/bin:...',
$pkg = $osfamily ? {
'redhat' => 'gcc',
'debian' => [ 'gcc', 'build-essential' ],
}
package { $pkg:
ensure => present,
}
@binford2k
binford2k / data.rb
Last active December 22, 2015 12:09
#! /usr/bin/env ruby
require 'yaml'
data = {
'somekey' => 'a value',
'another key' => [ 'an', 'array', 'of', 'values' ],
'a final key' => 'last value',
}
# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
if [ ! -d /root/.ssh ] ; then
mkdir -p /root/.ssh
chmod 0700 /root/.ssh
class apache {
#### update this section #####
case $::osfamily {
'RedHat': {
$httpd_user = 'apache'
$httpd_group = 'apache'
$httpd_pkg = 'httpd'
$httpd_svc = 'httpd'
$httpd_conf = 'httpd.conf'
$httpd_confdir = '/etc/httpd/conf'
path /certificate_status
method find, search, save, destroy
auth yes
allow pe-internal-dashboard,provisioner.mydomain.com
define booga::booga (
$setting,
$another = 'baz',
) {
# use the variables passed in. $name is a magic variable that comes from the title of the declared resource
exec { "/path/to/some/script --enable ${setting} --with-${another} ${name}": }
}
# declare three copies, identical except for title/name
booga::booga { ['one', 'two', 'three']:
# /etc/mcollective/policies/service.policy
# The file is active, because if I change this to allow, then actions are allowed
policy default deny
# but this line doesn't work. These are hard tabs.
allow * restart *
when_invoked do |path, options|
require 'puppet/network/http_pool'
connection = Puppet::Network::HttpPool.http_instance(Puppet[:server], Puppet[:masterport])
connection.request_get(path, {"Accept" => options[:accept]}).body
end