Skip to content

Instantly share code, notes, and snippets.

View tkishel's full-sized avatar

Thomas Kishel tkishel

  • Wiz
  • Portland, OR
View GitHub Profile
@tkishel
tkishel / agent_not_reporting.md
Last active March 25, 2020 23:43
Decision Tree: Agent Not Reporting in the Console

Decision Tree: Agent Not Reporting in Console on Master

  • Verify the server setting in puppet.conf on the Agent is set to the Master (or the Load Balancer of the Master).

  • Verify that the Puppet Agent service is running on the Agent.

    • If it not running, review the Application and System logs.
      • If you find a correlated "Puppet Agent service entered the stopped state" event ...
        • A process or a user explicitly stopped the service.
          • Look for the process or user that stopped the service.
  • If you find a correlated "Puppet Agent service terminated unexpectedly" event ...

$puppet_service = GWMI Win32_service | Where Name -eq 'puppet' | Select Name,ProcessId,State,Status
$pxpagent_service = GWMI Win32_service | Where Name -eq 'pxp-agent' | Select Name,ProcessId,State,Status
$puppet_process = Get-Process | Where Name -eq 'puppet' | Select Id
$pxpagent_process = Get-Process | Where Name -eq 'pxp-agent' | Select Id
Write-Host Puppet Service $puppet_service
Write-Host PXP-Agent Service $pxpagent_service
if (($pxpagent_service.State -NotLike 'Running') -or ($pxpagent_service.Status -NotLike 'OK')) {
Write-Host

Configure Master

# cat site.pp
node 'pe-201810-master.puppetdebug.vlan' {
  include resource_api::server
}

node 'pe-201810-agent.puppetdebug.vlan' {
  include resource_api::agent
@tkishel
tkishel / https_file.pp
Last active May 18, 2018 16:01
Workaround for PUP-7814
# PUP-7814: HTTPS file sources with non-puppet-trusted certs cannot be used
# TODO: Rewrite to accept and pass other File resource attributes to the resulting file.
# TODO: Identify a dependable alternative to grep on Windows.
define https_file (
String $cert,
String $path = $name,
String $temp = "${path}.download",
Pattern[/^https/] $source,
@tkishel
tkishel / reuse_forgotten_replica.sh
Last active October 3, 2019 21:39
Reset a Replica for Reuse (aka RRR)
#!/bin/bash
# The Puppet Enterprise High Availability documentation states:
#
# Run the forget command whenever a replica node is destroyed,
# even if you plan to replace it with a replica with the same name.
#
# Some users prefer to forget and reuse (instead of destroy and replace) a replica.
# As an alternative, when `/opt/puppetlabs/bin/puppet-enterprise-uninstaller` isn't available,
# this script uninstalls Puppet Enterprise on the Replica.
@tkishel
tkishel / puppet_env.md
Created August 18, 2017 16:28
Puppet ENV Inspection
# The env of the daemonized puppet as per /proc/pid/environ:
cat /proc/$(cat /var/run/puppetlabs/agent.pid)/environ

LANG=en_US.UTF-8PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

Given this manifest ....