Skip to content

Instantly share code, notes, and snippets.

View glarizza's full-sized avatar

Gary Larizza glarizza

  • Open Infrastructure Services
  • Portland, Oregon
View GitHub Profile
@glarizza
glarizza / install.pp
Created September 28, 2017 21:06
Install
archive { "apache-activemq-${version}-bin.tar.gz":
ensure => present,
extract => true,
extract_path => '/opt',
source => "http://archive.apache.org/dist/activemq/${version}/apache-activemq-${version}-bin.tar.gz",
@glarizza
glarizza / stuff.pp
Last active September 27, 2017 21:40
Puppet stuff
class profile::staging {
class { ‘staging’:
path => ‘/opt/staging’,
}
}
class profile::activemq (
$version = '5.14.3',
) {
include profile::staging
cron { 'Postgres database backups':
command => "sudo -u pe-postgres /opt/puppetlabs/server/apps/postgresql/bin/pg_dumpall -c -f ${postgres_backup_target_dir}/postgres_backup.`/bin/date +%Y%m%d`.sql",
hour => $postgres_backup_cron_hour,
minute => $postgres_backup_cron_minute,
}
define domain::gem::localinstall (
$gem_path,
$gem_name = $title,
$gem_version = undef,
$puppetserver_gem_dir = '/opt/puppetlabs/server/data/puppetserver/jruby-gems/gems'
) {
## Validation and setting variables
$gem_ensure = pick($gem_version, 'installed')
validate_absolute_path($gem_source)
validate_absolute_path($puppetserver_gem_dir)
dell_region = case real_domain
when /^(aus).dell.com/
'AMER'
when /^(lon).dell.com/
'EMEA'
else
'UNKNOWN'
end
Facter.add('dell_location') do
@glarizza
glarizza / puppet_issues.md
Created January 27, 2016 18:41
Puppet Issues

I'm seeing the following errors pop up:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: The value 'certdir' cannot be converted to Numeric. on node agent1.puppetlabs.vm
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

This results from the following code:

#!/usr/bin/env ruby
require 'thread'
require 'yaml'
if ARGV.size != 2
puts "You must run this script with two arguments: Concurrency, and the Total Number of Runs to Perform"
exit 1
end
CONCURRENCY = ARGV[0].to_i
@glarizza
glarizza / gist:a244124079110bf8ec6b
Created July 29, 2015 20:06
InfluxDB Graphite Plugin Issues
[root@ip-10-12-111-57 influxdb]# /opt/puppet/bin/facter os
{"name"=>"RedHat", "family"=>"RedHat", "release"=>{"major"=>"6", "minor"=>"6", "full"=>"6.6"}}
[root@ip-10-12-111-57 influxdb]# /opt/influxdb/influx -version
InfluxDB shell 0.9.1-rc1-326-g2a02605
----------------------------------------
-------- Current Config ---------
@glarizza
glarizza / classifier.rb
Last active August 29, 2015 14:08
Read classification information
#!/opt/puppet/bin/ruby
require 'puppet'
require 'uri'
require 'json'
require 'net/http'
# Need to parse the Puppet config to get certificate info later
Puppet.parse_config
# <modulepath>/extract_backend/lib/hiera/backend/extract_backend.rb
require 'yaml'
class Hiera
module Backend
class Extract_backend
def lookup(key, scope, order_override, resolution_type)
# Start your work here...
Hiera.debug "We're in the lookup method!"