Skip to content

Instantly share code, notes, and snippets.

View PatOShea's full-sized avatar

Pat O'Shea PatOShea

View GitHub Profile
@PatOShea
PatOShea / README.md
Created March 1, 2018 00:17 — forked from tknerr/README.md
Vagrant with Ansible Provisioner on Windows

Vagrant with Ansible Provisioner on Windows

Long story short, ansible does not work on a Windows control machine, so you basically have to:

  • either run ansible --connection=local ... in the target vm
  • set up a separate control vm where ansible is installed via shell provisioner

Below are Vagrantfile examples for both approaches

Within the Target VM

@PatOShea
PatOShea / dirtywebserver.ps1
Created March 24, 2017 20:25 — forked from obscuresec/dirtywebserver.ps1
Dirty PowerShell Webserver
$Hso = New-Object Net.HttpListener
$Hso.Prefixes.Add("http://+:8000/")
$Hso.Start()
While ($Hso.IsListening) {
$HC = $Hso.GetContext()
$HRes = $HC.Response
$HRes.Headers.Add("Content-Type","text/plain")
$Buf = [Text.Encoding]::UTF8.GetBytes((GC (Join-Path $Pwd ($HC.Request).RawUrl)))
$HRes.ContentLength64 = $Buf.Length
$HRes.OutputStream.Write($Buf,0,$Buf.Length)
@PatOShea
PatOShea / laptop
Last active June 24, 2020 16:16
Personal-Chocolatey
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# Stop getting prompted
choco feature enable -n=allowGlobalConfirmation
# Show file extenstions and such
choco install win-no-annoy -y
# basics
choco install microsoft-windows-terminal -y
@PatOShea
PatOShea / debug-output.log
Created March 4, 2016 06:48
kitchen-salt diagnose --all (verifier error with serverspec on install)
C:\kitchen-salt-tutorial\beaver-formula>kitchen diagnose --all
---
timestamp: 2016-03-04 06:45:40 UTC
kitchen_version: 1.5.0
plugins:
driver:
Vagrant:
@PatOShea
PatOShea / debug-output.log
Created March 4, 2016 06:39
kichen-salt failure on verify with serverspec
C:\kitchen-salt-tutorial\beaver-formula>kitchen verify default -l debug
-----> Starting Kitchen (v1.5.0)
D [Vagrant command] BEGIN (vagrant --version)
D [Vagrant command] END (0m0.00s)
D [Vagrant command] BEGIN (vagrant plugin list)
D [Vagrant command] END (0m0.00s)
D Winrm Transport requested, loading WinRM::Transport gem (["~> 1.0", ">= 1.0.3"])
D WinRM::Transport library loaded
D The winrm-s gem is being loaded to enable sspiauthentication.
D winrm-s is loaded. sspinegotiate auth is now available.
@PatOShea
PatOShea / README.rst
Created November 10, 2015 19:01 — forked from deuscapturus/README.rst
SaltStack Bootstrap for AWS EC2

SaltStack Bootstrap Script for AWS EC2

This script will currently only work with Windows8, Windows 2012R2, Amazon Linux, RHEL6 and RHEL7.

ISSUE HERE: https://github.com/saltstack/salt/issues/22796
DOCS HERE: https://docs.vagrantup.com/v2/provisioning/salt.html
SOURCE HERE: https://github.com/saltstack/salt/blob/develop/pkg/windows/buildenv/conf/minion#L4
ipc_mode: tcp
multiprocessing: True
@PatOShea
PatOShea / CreateNanoServer.ps1
Last active August 29, 2015 14:25
Build Nano Server
cd c:\temp\
. .\NanoServer.ps1
cls
$pass = ConvertTo-SecureString -String 'vagrant' -AsPlainText -Force
$paramHash = @{
MediaPath = '.\NanoServer'
BasePath = '.\NanoBase'
@PatOShea
PatOShea / windows-minion-bootstrapper.ps1
Last active March 24, 2016 23:41
Bootstrap Salt Minion on Windows
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: CMD call to install Salt Minion from powershell via URL
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SET SALT_URL=https://chocolatey.org/install.ps1
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('%SALT_URL%'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\saltf\bin
#####################################################################################
# Powershell script to install Salt Minion via URL
#####################################################################################
@PatOShea
PatOShea / basic-salt-vagrantfile
Created July 4, 2015 21:45
Basic Salt Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "PatOShea/win2012R2-salt"
config.vm.hostname = "win2012R2-salt"
config.vm.guest = "windows"
# This important for salt provisioner. It's used in the provisioner code extensively
config.vm.communicator = "winrm"