Skip to content

Instantly share code, notes, and snippets.

View petems's full-sized avatar
🏠
Working from home

Peter Souter petems

🏠
Working from home
View GitHub Profile
@petems
petems / gist:a75e7d1002dd5e5d61486a061dedf9be
Last active January 8, 2017 23:38
Install Puppet Gist
apt-get install puppet-agent -y
@petems
petems / gist:d3d688aae2e89ad5a42a9d9e7cc04c7a
Created November 16, 2016 20:43
get_puppetserver_metrics.rb
require 'graphite-api'
require 'socket'
require 'net/http'
require 'uri'
require 'json'
hostname = Socket.gethostname
client = GraphiteAPI.new(
graphite: "localhost:2003",
@petems
petems / 10-epoch_curl.conf
Created November 3, 2016 00:31
curl_json Example
LoadPlugin curl_json
<Plugin curl_json>
<URL "http://date.jsontest.com/">
Instance "epoch"
<Key "milliseconds_since_epoch">
Type "count"
</Key>
</URL>
</Plugin>
self | tot | method
100.0% | 33.3% | hide_original_method : /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mocha-1.2.0/lib/mocha/class_method.rb
HOSTS:
database:
roles:
- default
- database
platform: el-6-x86_64
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
client:
class profile::vcs {
vcsrepo { '/opt/repository-example':
ensure => present,
provider => git,
source => 'https://github.com/cloudera/repository-example',
revision => '10abb2ff63a6a2c182aa90d6be120896b5d3a4cc',
}
vcsrepo { '/opt/spamassassin':
@petems
petems / gist:e144af6e1aa4555d74d5f776f868578e
Created May 17, 2016 17:37
centos-package-cron --output=stdout --skipold=false on and older CentOS 6
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: epel.mirrors.ovh.net
The following security advisories exist for installed packages:
Advisory ID: CESA-2014--0917
Severity: Critical
Packages:
* nss-sysinit-3.15.1-15.el6
* nss-util-3.15.1-3.el6
$swapfile_path = '/mnt/swap.1'
$margin = '5MB'
$expected_swapfile_size = '200MB'
if ($::swapfile_sizes and is_hash($::swapfile_sizes)) {
$margin_bytes = to_bytes($margin)
$existing_swapfile_bytes = to_bytes("${::swapfile_sizes[$swapfile_path]}kb")
$expected_swapfile_size_bytes = to_bytes($expected_swapfile_size)
@petems
petems / RPMpackages.rb
Created April 11, 2016 11:09 — forked from KartikTalwar/RPMpackages.rb
Create puppet facts for RPM packages
package_data = Facter::Util::Resolution.exec('rpm --query --all --qf "%{NAME}||%{VERSION}\n"')
package_data.split("\n").each do |line|
rpm_detail = line.split("||")
package_name = 'package_' + rpm_detail[0]
package_version = rpm_detail[1]
Facter.add(package_name) do
setcode do
archive { 'C:\Temp\':
path => 'C:\',
source => 'http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.0.M3/bin/apache-tomcat-9.0.0.M3.zip',
checksum => 'f2aaf16f5e421b97513c502c03c117fab6569076',
checksum_type => 'sha1',
extract => true,
extract_path => 'C:\Temp',
creates => 'C:\Temp\Tomcat',
}