Managing the Infrastructure Stack with PowerShell

Post on 18-Feb-2017

316 views 0 download

Transcript of Managing the Infrastructure Stack with PowerShell

Managing the InfrastructureStack with PowerShell

Josh AtwellDeveloper Advocate

SolidFire, now part of NetApp

@josh_atwell#PSHSUMMIT

Celebrating 10 Years of PowerShell2006 - 2016• Jeffrey Snover• Kenneth Hansen• Lee Holmes• Narayanan Lakshmanan• Hemant Mahawar• Bruce Payette• Hitesh Raigandhi• Dan Travison• Jim Truher• Krishna Vutukuri

Congratulations to the team members who’ve been there

since the beginning…...and thanks for all

the great work!

github.com/joshatwell

Josh.Atwell@NetApp.com@josh_atwell

Why PowerShell the Stack?Why wouldn’t you? PowerShell ALL the things!

Twitter PollI polled twitter to see how many layers people are managing with PowerShell

We Now Have• More Layers• More complexity• Consumption models

have shiftedSeeking• Management at Scale• DevOps / Lean Ops• More IT as a Service

Physical Hardware

Operating System

App

VirtualizationNSXACI

vCenter Server

vRealize Suite

Orchestrator

Operating System

App App

VIOHyper-V

System Center

Orchestrator

Let’s Start with the ToolsWhen you’re a hammer every problem is a nail.

More APIs = More PowerShellGrowth of infrastructure extensibility means more opportunities for PowerShell and its users

Infrastructure Tools• PowerShell• VMware PowerCLI• OpenStack PoshShell• Cisco UCS Powertool• HP Scripting Tools for

PowerShell• SolidFire PowerShell Tools• NetApp PowerShell Toolkit• Community

• PowerNSX• EMC {Code}

Physical Hardware

Operating System

App

VirtualizationNSXACI

vCenter Server

vRealize Suite

Orchestrator

Operating System

App App

VIOHyper-V

System Center

Orchestrator

Use CasesWhat to do with this toolbox

PowerShelling StackDuh• Reporting• Implementation• DevOps• Configuration• Extending Tools

Physical

Operating System

App

VirtualizationVirtual Switch

Uplink

VLANMTU

Ethernet Port

Switch Port

Storage

Adapter

Physical

Operating System

App

VirtualizationVMDK / VHD

Datastore

Storage

Volume/Lun

Disk / Mount

Hard Drives

Which VMDK?

Which Datastore?

Which Lun?

Process{$scsiID = ((Get-ScsiLun -Datastore $datastore).CanonicalName).Split(".")[1] $result = Get-SFVolume | Where{$_.ScsiNAAdeviceID -eq $scsiID} Return $result}

DMZDSC in the DMZOperating System

App DSC

vCenter Server

ESXi

DSC

DSC

VMware Tools

https://github.com/DevOpsForVMwareAdministrators/powershell-dsc

?

# Copy the script to the designated directory on target VM

Copy-VMGuestFile -Source $script -Destination $mofpath -LocalToGuest -VM $vm -HostCredential $cred -Server $vcenter -GuestCredential $guestcred

# Invoke the copied script on the target VM

Invoke-VMScript -ScriptText $moffile -VM $vm -HostCredential $cred -Server $global:DefaultVIServer -GuestCredential $guestcred

No Open Ports

PowerActions• Embeds PowerCLI with

vSphere Web Client• Extend web client

capabilities

Let’s learn some cmdletsJust Kidding. Let’s talk challenges

Core Challenges• Managing Multiple

Modules/Tools• Relationship Mapping• Scale

Multiple Providers• PSSnapin vs Modules• Each Vendor has an installer• $env:PSModulePath

Defaults• $home\Documents\

WindowsPowerShell\Modules; $pshome\Modules.

Physical

Operating System

App

VirtualizationVMDK / VHD

Datastore

Storage

Volume/Lun

Disk / Mount

Hard Drives

Which VMDK?

Which Datastore?

Which Lun?

Query for that information can be cumbersomeCollect All | Filter | Grab Piece you really wanted

Physical

Operating System

App

VirtualizationVirtual Switch

Uplink

VLANMTU

Ethernet Port

Switch Port

Adapter

Application DNAApplying Relationship Maps

Physical

Operating System

VirtualizationVirtual Switch

Uplink

Ethernet Port

Switch Port

Storage

Adapter

VMDK / VHD

Datastore

Volume/Lun

Disk / Mount

Hard Drives

JSONXMLCSV

SQL DB

vRAM

Sys Memory

pRAM

Server

ESXi Host

Example

$scsiID = ((Get-ScsiLun -Datastore $datastore).CanonicalName).Split(".")[1] $result = Get-SFVolume | Where{$_.ScsiNAAdeviceID -eq $scsiID}

$result | ConvertTo-JSON | Set-Content Datastore-Volume.JSON

$global:DSVol = (Get-Content Datastore-Volume.JSON) –join “`n” | ConvertFrom-JSON

$scsiID = ($global:DSVol | Where{$_.DatastoreName –eq ‘DatastoreName’}).scsiID$result = Get-SFVolume | Where{$_.ScsiNAAdeviceID -eq $scsiID}

Why App DNA?

• Quicker Reporting• Shorter Time to Resolution• Faster Implementation• Improve Value Stream• Dynamic Parameter Sets• Faster PowerActions or vRO

calls.

Growth Areas• More DSC Resources

• Cisco UCS PowerTool DSC

• Moving away from PSSnapins

Questions?