Skip to content

Instantly share code, notes, and snippets.

View bobalob's full-sized avatar

Dave Hall bobalob

View GitHub Profile
@bobalob
bobalob / Inline-Images.PS1
Created November 2, 2016 20:29
Generate Inline Images for an email in PowerShell
Param(
[Parameter(Mandatory = $true)] $imagePathArray,
[Parameter(Mandatory = $true)] $emailFrom,
[Parameter(Mandatory = $true)] $emailSubject,
[Parameter(Mandatory = $true)] $smtpServer,
[Parameter(Mandatory = $true)] $SendTo,
$emailBodyTitle=$emailSubject
)
if (!($imagePathArray.Gettype().BaseType.Name -eq "Array")) {
Write-Host "ImagePathArray must be of type Array"
@bobalob
bobalob / Get-PoolDetails-Function.PS1
Created November 2, 2016 20:33
Simple Wrapper for EMC VNX Pool Details
Function Get-PoolDetails {
Param(
[Parameter(Mandatory=$true)]$StorageProc
)
$PoolInfo = naviseccli -h $StorageProc storagepool -list
$poolLine1TAG = "Pool Name"
$poolLine2TAG = "Pool ID"
$poolLine3TAG = "LUNs"
$poolLine4TAG = "User Capacity \(GBs\)"
$poolLine5TAG = "Available Capacity \(GBs\)"
@bobalob
bobalob / Network.tf
Last active November 3, 2016 20:33
Example Terraform files for Azure Resource Manager
# Create a virtual network in the web_servers resource group
resource "azurerm_virtual_network" "pipelineNetwork" {
name = "pipelineNetwork"
address_space = ["10.0.0.0/16"]
location = "North Europe"
resource_group_name = "${azurerm_resource_group.pipelineResources.name}"
}
resource "azurerm_subnet" "pipelineSubnet1" {
name = "pipelineSubnet1"
sudo apt-get update
sudo apt-get install -y jq nodejs npm
sudo npm install -g azure-cli
sudo ln -s /usr/bin/nodejs /usr/bin/node
{
"variables": {
"azure_client_id": "{{env `PACKER_ARM_CLIENT_ID`}}",
"azure_client_secret": "{{env `PACKER_ARM_CLIENT_SECRET`}}",
"azure_subscription_id": "{{env `PACKER_ARM_SUBSCRIPTION_ID`}}",
"azure_object_id": "{{env `PACKER_ARM_OBJECT_ID`}}"
},
"builders": [{
#This will not create the storage account for use with packer, just the auth
Param (
$ApplicationName="Packer",
$AppURL="http://packer.io",
[Parameter(Mandatory=$true)]$AppPassword,
$AppRoleAssigned="Owner"
)
$Account = Login-AzureRmAccount
$Subs = Get-AzureRmSubscription
resource "azurerm_lb_nat_rule" "winrm_nat" {
location = "${var.azure_region_fullname}"
resource_group_name = "${azurerm_resource_group.resource_group.name}"
loadbalancer_id = "${azurerm_lb.load_balancer.id}"
name = "WinRM-HTTPS-vm-${count.index}"
protocol = "Tcp"
frontend_port = "${count.index + 10000}"
backend_port = "${var.vm_winrm_port}"
frontend_ip_configuration_name = "${var.vm_name_prefix}-ipconfig"
count = "${var.vm_count}"
ip_configuration {
name = "${var.vm_name_prefix}-${count.index}-ipConfig"
subnet_id = "${azurerm_subnet.subnet1.id}"
private_ip_address_allocation = "dynamic"
load_balancer_backend_address_pools_ids = ["${azurerm_lb_backend_address_pool.backend_pool.id}"]
load_balancer_inbound_nat_rules_ids = ["${element(azurerm_lb_nat_rule.winrm_nat.*.id, count.index)}"]
}
# VIP address
resource "azurerm_public_ip" "load_balancer_public_ip" {
name = "${var.vm_name_prefix}-ip"
location = "${var.azure_region_fullname}"
resource_group_name = "${azurerm_resource_group.resource_group.name}"
public_ip_address_allocation = "dynamic"
domain_name_label = "${azurerm_resource_group.resource_group.name}"
}
# Front End Load Balancer
configuration NewDomain
{
param
(
[Parameter(Mandatory)]
[pscredential]$safemodeAdministratorCred,
[Parameter(Mandatory)]
[pscredential]$domainCred
)