This file contains 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
[epel] | |
name=Extra Packages for Enterprise Linux 5 - $basearch | |
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch | |
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch | |
failovermethod=priority | |
enabled=1 | |
gpgcheck=0 | |
[epel-puppet] | |
name=epel puppet |
This file contains 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
[root@tdc00demo ~]# cat /etc/settings.php | |
<?php | |
$db_url = 'mysqli://user:pass@host/database'; | |
?> | |
[root@tdc00demo ~]# cat settings_php.augtool | |
set /augeas/load/Phpvars/incl[last()+1] "/etc/settings.php" | |
load | |
[root@tdc00demo ~]# augtool --noload -if settings_php.augtool | |
augtool> print /augeas/load/Phpvars | |
/augeas/load/Phpvars |
This file contains 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
[root@training manifests]# puppet apply alpha.pp | |
notice: beta | |
notice: /Stage[before]/Beta/Notify[beta]/message: defined 'message' as 'beta' | |
notice: alpha | |
notice: /Stage[before]/Alpha/Notify[alpha]/message: defined 'message' as 'alpha' | |
notice: gamma | |
notice: /Stage[main]/Gamma/Notify[gamma]/message: defined 'message' as 'gamma' | |
notice: Finished catalog run in 0.08 seconds | |
[root@training manifests]# cat alpha.pp | |
stage { 'before': before => Stage['main'], } |
This file contains 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
hostclass 'jetty::services' do | |
#{ | |
# "zakenregister-1.0"=>{"instances"=>"2", "groupid" => "nl.cjib.jetty"}, | |
# "zakenregister-2.0"=>{"instances"=>"2", "groupid" => "nl.cjib.jetty"}, | |
# "zakenregister-2.2"=>{"instances"=>"4", "groupid" => "nl.cjib.jetty"}, | |
# "somethingelse-2.2"=>{"instances"=>"4", "groupid" => "nl.cjib.jetty"} | |
#} | |
services = scope.function_hiera_hash("services") | |
nexus_repo_url = scope.function_hiera("nexus_repo_url") | |
services.each do |service_version, params| |
This file contains 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
hostclass :base do | |
files = { | |
"/tmp/a" => "abc", | |
"/tmp/foo" => scope.function_template("foo.erb"), | |
"/tmp/bar" => '' | |
} | |
files.each do |filename, content| | |
file filename, | |
:content => content | |
end |
This file contains 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.add('maint_ip') do | |
setcode do | |
interfaces = Facter.value('interfaces').split(',') | |
maint_ip = nil | |
interfaces.each do |interface| | |
maint_ip = Facter.value('ipaddress_' + interface) if Facter.value('ipaddress_' + interface) =~ /^172.30/ | |
end | |
maint_ip || Facter.value('ipaddress_eth0') | |
end | |
end |
This file contains 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
diff --git a/lib/puppet/parser/functions/hiera_hash.rb b/lib/puppet/parser/functions/hiera_hash.rb | |
index 5d49d59..237fa0f 100644 | |
--- a/lib/puppet/parser/functions/hiera_hash.rb | |
+++ b/lib/puppet/parser/functions/hiera_hash.rb | |
@@ -21,7 +21,7 @@ module Puppet::Parser::Functions | |
hiera = Hiera.new(:config => config) | |
- if self.respond_to?("{}") | |
+ if self.respond_to?("[]") |
This file contains 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
#lib/puppet/parser/functions/search.rb | |
Puppet::Parser::Functions.newfunction(:search, :type => :rvalue) do |args| | |
require 'puppet/face' | |
environment = scope.lookupvar('::environment') | |
Puppet::Face[:facts_search, 'v0.0.1'].search(args.flatten, "environment=#{environment}") | |
end | |
#lib/puppet/face/facts_search.rb | |
require 'puppet/face' |
This file contains 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
def tags | |
@tags = get_meter("tags", resource).sort | |
@tags | |
end |
This file contains 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.add(:environment) do | |
setcode do | |
if defined? Puppet and Puppet.application_name == :agent | |
Puppet[:environment] | |
else | |
Facter::Util::Resolution.exec('puppet agent --configprint environment') | |
end | |
end | |
end |