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 | |
# GIST_URL: https://gist.github.com/natemccurdy/13e3b2d8477dbd6bd01d | |
# Run this on a puppetserver to delete its JRuby pools to clear their cache. | |
# A response of "HTTP/1.1 204 No Content" means it worked. | |
# | |
# https://docs.puppetlabs.com/puppetserver/latest/admin-api/v1/jruby-pool.html | |
CONFDIR="$(puppet master --configprint confdir)" | |
CERT="$(puppet master --confdir "${CONFDIR}" --configprint hostcert)" |
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 | |
# GIST_URL: https://gist.github.com/natemccurdy/65676368168708810c29 | |
# Get the list of classes that the Puppetserver knows about. | |
# https://docs.puppetlabs.com/puppet/latest/reference/http_api/http_environments.html | |
CERT="$(puppet agent --configprint hostcert)" | |
CACERT="$(puppet agent --configprint localcacert)" | |
PRVKEY="$(puppet agent --configprint hostprivkey)" | |
OPTIONS="--cert ${CERT} --cacert ${CACERT} --key ${PRVKEY}" | |
MASTER="$(puppet agent --configprint server)" |
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
# | |
# win_pagefile/manifests/init.pp | |
# | |
# Move pagefile to D: drive, reboot. | |
class win_pagefile ( | |
$pagefile_drive = 'd', | |
) { | |
if $::pagefile_location =~ '[Cc]\:' or $::pagefile_automanaged == true { | |
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
$rc_local = @(RC_LOCAL) | |
#!/bin/sh | |
# This file is managed by Puppet. Any modifications will be overwritten. | |
touch /var/lock/sybsys/local | |
echo '# Increase SCSI timeout on all SCSI disks attached to the system at boot time' | |
ls -1 /sys/block/sd*/device/timeout | while read file | |
do | |
echo 360 > $file |
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 | |
# GIST_URL: https://gist.github.com/natemccurdy/d1abe94f9688de9d7ea38bfd3b2e8d43 | |
# Dumps the Node Classifier groups to a file. This file can be used to restore classification. | |
# | |
SCRIPTNAME="$(basename "$0")" | |
PATH="/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin:/opt/puppet/bin:$PATH" | |
PE_CERT=$(puppet agent --configprint hostcert) | |
PE_KEY=$(puppet agent --configprint hostprivkey) | |
PE_CA=$(puppet agent --configprint localcacert) |
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 custom fact will figure out which application | |
# a node belongs to by looking at the node's hostname | |
# and comparing that to a known list of applications. | |
# | |
# This fact relies on a naming convention where the | |
# first three letters of a node's hostname signify | |
# what application that node belongs to. | |
# | |
Facter.add(:application) do | |
setcode do |
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
# GETTING STARTED | |
# 1. Install the Puppet agent from http://downloads.puppetlabs.com/windows/puppet-agent-1.3.6-x64.msi | |
# 2. puppet module install chocolatey-chocolatey | |
# 3. puppet module install cyberious-apm | |
# 4. puppet apply windows_dev_node.pp | |
include chocolatey | |
$choco_packages = [ | |
'git', |
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
# Build a registry value string for setting DNS servers on windows | |
$dns_servers = [ '1.1.1.1', '2.2.2.2', '3.3.3.3' ] | |
$suffixes = [ '0x09', '0x0a' ] | |
# Generate an array that has 0x09 after the first server, and | |
# 0x0a after all the other servers. | |
$array = $dns_servers.map |$index, $server| { | |
if $index == 0 { | |
"${server},${suffixes[0]}" |
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 requires the pltraining/rbac module from the Forge. https://forge.puppet.com/pltraining/rbac | |
# Last tested on Puppet Enterprise 2016.1.2 | |
# | |
# If an RBAC role already exists, the curl will return "There was a database conflict". | |
# This isn't perfect.... try at your own risk. | |
$deploy_role_name = 'Deploy Code' | |
$deploy_role_description = 'Users that are able to deploy code using Code Manager' | |
$console_master_certname = $::trusted['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
# A Batman module to show how to namespace classes in Puppet | |
batman | |
└── manifests | |
├── init.pp ==> class batman | |
├── belt.pp ==> class batman::belt | |
├── tools | |
│ ├── batarang.pp ==> class batman::tools::batarang | |
│ ├── hook.pp ==> class batman::tools::hook | |
│ └── smoke.pp ==> class batman::tools::smoke |