Skip to content

Instantly share code, notes, and snippets.

View ryanycoleman's full-sized avatar

Ryan Coleman ryanycoleman

  • Stackery
  • Portland, OR
View GitHub Profile
@ryanycoleman
ryanycoleman / gist:1634941
Created January 18, 2012 19:03
mco puppetral
peadmin@training:~$ mco rpc puppetral create type=user title=elmo ensure=present
Determining the amount of hosts matching filter for 2 seconds .... 1
* [ ============================================================> ] 1 / 1
training.puppetlabs.lan
Status: Resource was created
Resource: {"exported"=>false,
"title"=>"elmo",
@ryanycoleman
ryanycoleman / gist:1648544
Created January 20, 2012 17:24
functions move
- Classes
- - parameterised
- - abbreviated_relationships
- - exercise_hidd
- Defined Resource Types
- - overview
- usage
- example
- module_structure
- exercise
# modulepath is /etc/puppetlabs/puppet/modules
# helloworld/manifests/init.pp
class helloworld {
file { '/tmp/hello':
ensure => file,
source => "puppet:///modules/helloworld/hello",
}
[root@centos6 lib]# puppet master --configprint libdir
/var/lib/puppet/lib
[root@centos6 lib]# tree .
.
├── hiera
│   ├── backend
│   │   └── puppet_backend.rb
│   └── scope.rb
└── puppet
└── parser
# Generates facts of the version pkg_foo => 'version'
begin
require 'puppet'
pkgs = Puppet::Type.type(:package).instances
pkgs.each do |pkg|
Facter.add("pkg_#{pkg[:name]}") do
value = pkg.provider.properties[:ensure]
if value != :absent
@ryanycoleman
ryanycoleman / dalen-dnsquery.pp
Created August 16, 2012 00:27
Silly example usage of the functions provided by Forge module dalen-dnsquery http://forge.puppetlabs.com/dalen/dnsquery
$forge_cname = dns_cname('forge.puppetlabs.com')
$dns_a = dns_a( $forge_cname )
$dns_aaaa = dns_aaaa('forge.puppetlabs.com')
notify { "forge.puppetlabs.com is a cname for ${forge_cname} with IPs ${dns_a} & ${dns_aaaa}": }
ini_setting { "puppet_pluginsync":
ensure => present,
path => '/etc/puppet/puppet.conf',
section => 'main',
setting => 'pluginsync',
value => 'true',
}
@ryanycoleman
ryanycoleman / community_downloads.txt
Created July 12, 2013 20:46
community download counts, ascending order
[["rtyler/puppet", 9],
["wcooley/fail_unconfigured", 18],
["bobsh/puppetdb", 30],
["cloudsmith/demoapp", 51],
["gioppoluca/wso2am", 55],
["gioppoluca/wso2bam", 59],
["ngiger/elexis_cockpit", 60],
["gioppoluca/moodle", 60],
["reidmv/mcollective", 61],
["viirya/storm", 61],
@ryanycoleman
ryanycoleman / community_downloads-07-12-2013.txt
Last active December 19, 2015 16:59
Forge module download counts, not from the puppetlabs namespace, sorted in ascending order.
[["rtyler/puppet", 9],
["wcooley/fail_unconfigured", 18],
["bobsh/puppetdb", 30],
["cloudsmith/demoapp", 51],
["gioppoluca/wso2am", 55],
["gioppoluca/wso2bam", 59],
["ngiger/elexis_cockpit", 60],
["gioppoluca/moodle", 60],
["reidmv/mcollective", 61],
["viirya/storm", 61],
@ryanycoleman
ryanycoleman / centos_6_vagrantfile
Last active December 21, 2015 08:09
PuppetConf DevDay 2013 Cut-sheet
# -*- mode: ruby -*-
# vi: set ft=ruby :
# For the most part, this is a stock config from `vagrant init`
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.