This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%if 0%{?fedora} || 0%{?rhel} >= 5 | |
BuildArch: noarch | |
Requires: ruby(abi) = 1.8 | |
Requires: ruby-shadow | |
%endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat foo.pp | |
class a { | |
file{'/tmp/a': ensure => file} | |
file{'/tmp/b': ensure => file} | |
} | |
class b inherits a { | |
File['/tmp/b']{ensure => absent } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Having masterzen's patch applied puppet still burns 100% cpu _after_ doing all the changes | |
# I use the following resource | |
file{'/home/duritong': | |
ensure => directory, | |
recurse => true, | |
backup => false, | |
checksum => none, | |
owner => 'duritong', group => 'duritong', mode => 0600; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ facter | grep puppet | |
puppetversion => 2.6.1 | |
$ cat lib/puppet/parser/functions/array_del.rb | |
Puppet::Parser::Functions::newfunction( | |
:array_del, | |
:type => :rvalue, | |
:doc => "Deletes items from an array | |
Example: array_del(['a','b'],'b') -> ['a']" | |
) do |args| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'puppet/util/run_mode' | |
$puppet_application_mode = Puppet::Util::RunMode.new(:master) | |
require 'puppet' | |
require 'puppet/rails' | |
Puppet.settings.unsafe_parse('/etc/puppet/puppet.conf') | |
Puppet::Rails.connect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#some_template.erb | |
<%- [:foo, :bar].each do |state| %> | |
<%= scope.function_template('some/other_template.erb') %> | |
<%- end %> | |
# some/other_template.erb | |
<%- if state == :foo %> | |
write something | |
<%- end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class site-puppet::cron inherits puppet::cron { | |
include site-puppet::cron::debian | |
} | |
class site-puppet::cron::debian inherits puppet::cron::linux { | |
if $hostname != 'puppetmaster' { | |
File['puppet_config']{ source => undef, content => template("site-puppet/client/puppet.conf") } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'digest/sha2' | |
require 'active_support' | |
def password(pass) | |
salt = 32.times.collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join | |
"{SSHA512}#{ActiveSupport::Base64.encode64s(Digest::SHA512.digest(pass + salt)+salt)}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commands ping => "/usr/bin/ping" | |
... | |
# we can use it later with: | |
# ping "www.puppetlabs.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support' | |
module ModuleA | |
def self.included(c) | |
c.class_attribute :foo | |
c.extend ClassMethods | |
end | |
module ClassMethods | |
def set_foo(value) |