Skip to content

Instantly share code, notes, and snippets.

#######################
### determine agent ###
#######################
$dir = "C:\Users\Administrator\Downloads"
$agent = Get-ChildItem $dir | Where-Object {$_.Extension -eq ".msi"}
msiexec /qn /norestart /l*v puppet_agent_install.log /i $agent.fullname PUPPET_MASTER_SERVER=master.puppetlabs.vm
#############################
### Remove RunOnce Script ###
#############################
##############################
### Check if Administrator ###
##############################
$user = [Environment]::UserName
If ($user -ne "Administrator") {
Write-Host "`n`n`nPlease logout and login as Administrator!`n`n`n"
Start-Sleep -s 5
break
} else {
Write-Host "`n`n`nContinuing the setup.`n`n`n"
###############
# New version #
###############
curl --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem \
--cert /etc/puppetlabs/puppet/ssl/certs/pirate.puppetlabs.vm.pem \
--key /etc/puppetlabs/puppet/ssl/private_keys/pirate.puppetlabs.vm.pem \
https://master.puppetlabs.vm:8140/puppet/v3/catalog/pirate.puppetlabs.vm?environment=production \
| jq .
#################################################################
pirate.puppetlabs.vm.yaml
---
nginx::vhosts:
testing.pirate.puppetlabs.vm:
docroot: "/var/www/testing"
dev.pirate.puppetlabs.vm:
docroot: "/var/www/dev"
#### Hiera 3 ####
### Opening file to edit
vim <file_name> either new or existing file_name
### Entering edit mode
a append after cursor
A append at end of line
i insert before cursor
I insert at beginning of line
o opens new line below cursor
O opens new line above cursor
#!/bin/sh
sep='##########'
localpath=`pwd`
for x in */; do
x=`echo $x | sed s#/##` #Get repo name from base directory structure
header="$(tput setaf 1)$sep Processing $x $d$sep$(tput sgr0)" #Set header for printing repo info
head=`git -C $localpath/$x rev-parse --abbrev-ref HEAD` #Set head name
hash=`git -C $localpath/$x rev-parse HEAD` #Set head hash
echo $header #Print header
--- custom fact ---
Facter.add(:if_speed) do
setcode do
Facter::Core::Execution.exec('bash script')
end
end
--- bash script ---
#!/bin/bash
@josephoaks
josephoaks / GSWP Lab Commands.md
Last active October 2, 2019 18:51
The Exercise Guide PDF does not copy and paste commands that are multi line very well...

URL Shortcode https://goo.gl/mtEMXK

Lab 2.2: Running commands

Task 1: Run local system commands

Step 1
  Steps for Windows:
    PS C:\> bolt command run 'net stop w32time' --nodes winrm://localhost --user Administrator --no-ssl --password
  
  Steps for Linux:

$ bolt command run 'sudo systemctl stop ntpd' --nodes ssh://localhost --user centos --no-host-key-check

@josephoaks
josephoaks / Resize and Create Partition
Last active October 28, 2021 22:28
Resize and Create Partition.md
# Resize partition and create new using Parted
## Resizing the partition
```text
pi1:~ # parted
```
*your output should look similar*