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
# <modulepath>/aix_reload/examples/test.pp | |
user { 'newuser007': | |
ensure => present, | |
provider => aix_reload, | |
before => Notify['foo'], | |
} | |
notify { 'foo': } |
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
# This defined type provides a clean interface that allows users to specify DNS | |
# zone attributes they're familiar with - origin, ttl, etc - to manage a zone | |
# file. It then uses an Augeas resource to implement the configuration | |
# specified by the user. | |
# | |
# The Augeas type is difficult to use so it's not great to actually write a lot | |
# of Augeas resources. By creating ausing a defined type, we can do the | |
# difficult work of creating an Augeas resource once. We build ourselves a | |
# simple, easy-to-use repeatable resource type that we can then use multiple | |
# times in our Puppet code. |
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
#!/bin/bash | |
url='http://puppetmaster.local:8088/payload' | |
branches='' | |
while read oldrev newrev refname; do | |
branch=$(echo $refname | sed -n 's/^refs\/heads\///p') | |
branches="${branches} ${branch}" | |
done |
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
# Requires: | |
# - puppetlabs/stdlib | |
# - trlinkin/noop | |
class first { | |
$noop_value = getparam(Class['first'], 'noop') | |
notice("first noop is $noop_value") | |
if $noop_value == true { noop() } |
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
#!/opt/puppet/bin/ruby | |
require 'net/http' | |
require 'json' | |
events_query = URI.encode_www_form( | |
'query' => '["=","latest-report?",true]', | |
'summarize-by' => 'certname', | |
'count-by' => 'certname' | |
) |
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
#!/bin/bash | |
settings='hostcert hostprivkey localcacert' | |
setting_values=$(/opt/puppet/bin/puppet config print --section master $settings | tr -d ' ') | |
regex='(.*)=(.*)' | |
for setting in $setting_values; do | |
[[ $setting =~ $regex ]] && export puppet_${BASH_REMATCH[1]}=${BASH_REMATCH[2]} | |
done |
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
The following Puppet code examples demonstrate how Puppet can assist in | |
implementing a repository-based patching workflow. Chris St. Pierre does | |
a good job of describing the methodology in his whitepaper, "Staging | |
Package Deployment via Repository Management". | |
https://www.usenix.org/legacy/event/lisa11/tech/full_papers/Pierre.pdf |
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 profile::app::delicapp ( | |
$ref = 'master', | |
$version = '1.2', | |
) { | |
include ::tomcat | |
include ::java | |
tomcat::instance { 'tomcat8': | |
catalina_base => '/opt/apache-tomcat/tomcat8', |
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 updates ( | |
$update_repo = 'patchlevel', | |
$enforce = false, | |
) { | |
yumrepo { 'patchlevel': | |
baseurl => "http://${::servername}/patches", | |
descr => 'Patch Level Repo', | |
enabled => 1, | |
gpgcheck => 1, |
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
# This type needs to implement an "autobefore" kind of behavior. Currently | |
# the Puppet type system only supports autorequire, so we achieve autobefore | |
# by hijacking autorequire. | |
def autorequire(rel_catalog = nil) | |
reqs = super | |
[ @parameters[:prior_to].value, | |
@parameters[:resource].value | |
].flatten.each do |rel| | |
reqs << Puppet::Relationship::new(self, catalog.resource(rel.to_s)) |