Skip to content

Instantly share code, notes, and snippets.

View joeypiccola's full-sized avatar
⛰️

Joey Piccola joeypiccola

⛰️
View GitHub Profile
@joeypiccola
joeypiccola / puppet_agent_log.pp
Created July 24, 2019 19:33
puppet code to manage how the puppet agent writes windows events
# move puppet windows events out of the Application log into a new log named Puppet
if $facts['os']['family'] == 'windows' {
registry_key { 'Application_Puppet':
ensure => absent,
path => 'HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Puppet',
}
registry_key { 'Puppet_Puppet':
ensure => present,
path => 'HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Puppet\Puppet',
require => Registry_key['Application_Puppet'],
@joeypiccola
joeypiccola / testnetforpuppet.ps1
Created June 10, 2019 17:39
test net ports from mr bush
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)]
[String]
$target_node,
[Parameter(Mandatory = $True)]
[Int]
$target_port
)
write-host 'hello from gist.github.com'
$url = "http://go.microsoft.com/fwlink/p/?LinkID=74689"
$file = "c:\windows\temp\Wsusscn2.cab"
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($url, $file)
# == Class: profile::web::config_demo
class profile::web::config_demo (
$websitename = 'LetsDoThis',
$zipname = 'website.zip',
$sourcerepo = 'http://repo.ad.piccola.us:8081/',
$destinationpath = 'C:\inetpub\LetsDoThis',
$defaultwebsitepath = 'C:\inetpub\wwwroot',
$zippath = 'C:\tmp'
){
# node & agent data
$master = 'puppet'
$role = 'base'
$environment = 'production'
# facts data
$teams = 'isg,sdm' # comma seperated list
$project = ''
$datacenter = 'denver' # maybe you need this maybe you don't
$application = ''
$application_environment = ''
Function Send-PushOver {
[CmdletBinding()]
Param (
[Parameter()]
[string]$Message,
[string]$Title,
[string]$User,
[string]$Token,
[uri]$Uri
)
ob@cirrus:~$ nmap --script=ssl-cert.nse -p 443 gmail.com
Starting Nmap 7.00 ( https://nmap.org ) at 2015-12-07 15:48 CET
Nmap scan report for gmail.com (173.194.112.21)
Host is up (0.014s latency).
Other addresses for gmail.com (not scanned): 2a00:1450:4001:80b::1015 173.194.112.22
rDNS record for 173.194.112.21: fra07s27-in-f21.1e100.net
PORT STATE SERVICE
443/tcp open https

add cert to puppet enterprise console

  1. generate a csr puppet.piccola.us.csr and submit it to a CA.
  2. download it puppet.piccola.us.cer in .der format. once downloaded add it to the personal store of a windows machine then export it with keys and extensions as a .pfx (e.g. puppet.piccola.us.pfx).
  3. at this point you should have the following three files.
C:\scripts\puppet_ec_cert\pec> l
    Directory: C:\scripts\puppet_ec_cert\pec
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
@joeypiccola
joeypiccola / inventoryjsonquery.ps1
Created April 27, 2018 21:09
example json query
$inventory = Get-Content -Path .\vcen_inventory.json | ConvertFrom-Json
# update the datacenters with what is available in the vcenter
Update-ComboBox -ComboBox $combobox2 -Items ($inventory.vcenters | ?{ $_.name -eq $vcenter }).datacenters.
# update the clusters with what is available in the datacenter
Update-ComboBox -ComboBox $combobox3 -Items (($inventory.vcenters | ?{ $_.name -eq $vcenter }).datacenters | ?{ $_.name -eq $datacenter }).clusters.
# update the datastores with what is available in the cluster
$datastores = ((($inventory.vcenters | ?{ $_.name -eq $vcenter }).datacenters | ?{ $_.name -eq $datacenter }).clusters | ?{ $_.name -eq $cluster }).datastoresclusters | select @{ Name = "value"; Expression = { "$($_.name), $([math]::Round($_.freespacegb, 0)) GB free" } }