Skip to content

Instantly share code, notes, and snippets.

@robinbowes
robinbowes / config.pp
Created September 28, 2015 20:14
Add a content parameter to config
# Installs RackTables
class racktables::config (
$secretfile = $::racktables::secretfile,
$apacheuser = $::racktables::apacheuser,
$datadir = $::racktables::datadir,
$secretfile_content = $::racktables::secretfile_content
) {
validate_string($secretfile)
validate_string($apacheuser)
@robinbowes
robinbowes / init.pp
Last active August 29, 2015 14:25
"Must pass start_service to Class[Foo::Service]
class foo(
$start_service = undef
) {
class{'::foo::service':
start_service => $start_service,
}
}
@robinbowes
robinbowes / fixed.pp
Last active August 29, 2015 14:24
puppet parser warning killing rspec tests
# this is the corrected function
define foo_bar(
$ensure = true,
) {
# blah
}
@robinbowes
robinbowes / gist:74cf2ddb6bd3c2d26dfb
Created June 3, 2015 12:51
Default values in defines
define foo(
$bar = 'UNDEF'
) {
include ::some::config
$real_bar = $bar ? {
'UNDEF' => $::some::config::bar,
default => $bar,
}
}
#!/usr/bin/env ruby
require 'trollop'
require 'fpm'
# used to ensure versions extracted from gems are converted to
# semantic versioning-compliant strings before being used
# in RPM requires
require 'semverly'
#!/usr/bin/env ruby
#^syntax detection
forge "https://forgeapi.puppetlabs.com"
# Only need to add top-level role class.
# All other classes are recursively included
mod 'ubnt-role_activemq',
:git => '[email protected]:Ubiquiti-Cloud/role_activemq.git'
class role::myapp(
$environment,
) {
include profile::apache
include profile::apache::status
include ::apache::mod::php
include ::apache::mod::deflate
#include ::apache::mod::setenvif
apache::vhost { 'myapp.mysite.com':
@robinbowes
robinbowes / init.pp
Created February 1, 2015 01:32
Puppet templating
class test{
$domains = {
'domain1.tld' => {
'detail' => 'foo'
},
'domain2.tld' => {
'detail' => 'bar'
}
}
@robinbowes
robinbowes / gist:4e179b6090a456b34a27
Created January 22, 2015 23:46
Error when running puppet form mcollective
Jan 22 23:45:55 ip-172-20-14-143 puppet-agent[26617]: Caught USR1; calling reload
Jan 22 23:45:55 ip-172-20-14-143 puppet-agent[26427]: Could not autoload puppet/indirector/node/rest: current thread not owner
Jan 22 23:45:55 ip-172-20-14-143 puppet-agent[26427]: Unable to fetch my node definition, but the agent run will continue:
Jan 22 23:45:55 ip-172-20-14-143 puppet-agent[26427]: Could not autoload puppet/indirector/node/rest: current thread not owner
Jan 22 23:45:55 ip-172-20-14-143 puppet-agent[26427]: Could not autoload puppet/feature/external_facts: current thread not owner
Jan 22 23:45:55 ip-172-20-14-143 puppet-agent[26427]: Failed to apply catalog: Could not autoload puppet/feature/external_facts: current thread not owner
Jan 22 23:45:56 ip-172-20-14-143 puppet: /usr/share/ruby/vendor_ruby/puppet/agent.rb:87:in `exit': no implicit conversion from nil to integer (TypeError)
Jan 22 23:45:56 ip-172-20-14-143 puppet: from /usr/share/ruby/vendor_ruby/puppet/agent.rb:87:in `block in run_in_fork'
Jan 22 23
@robinbowes
robinbowes / gist:0e4ea8feffa3261fb33f
Created November 3, 2014 14:50
script to convert gems to RPMs
#!/usr/bin/env ruby
require 'trollop'
require 'fpm'
# used to ensure versions extracted from gems are converted to
# semantic versioning-compliant strings before being used
# in RPM requires
require 'semverly'