managing the infrastructure stack with powershell

26
Managing the Infrastructure Stack with PowerShell Josh Atwell Developer Advocate SolidFire, now part of NetApp @josh_atwell #PSHSUMMIT

Upload: josh-atwell

Post on 18-Feb-2017

316 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Managing the Infrastructure Stack with PowerShell

Managing the InfrastructureStack with PowerShell

Josh AtwellDeveloper Advocate

SolidFire, now part of NetApp

@josh_atwell#PSHSUMMIT

Page 2: Managing the Infrastructure Stack with PowerShell

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!

Page 3: Managing the Infrastructure Stack with PowerShell

github.com/joshatwell

[email protected]@josh_atwell

Page 4: Managing the Infrastructure Stack with PowerShell

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

Page 5: Managing the Infrastructure Stack with PowerShell

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

Page 6: Managing the Infrastructure Stack 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

Page 7: Managing the Infrastructure Stack with PowerShell

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

Page 8: Managing the Infrastructure Stack with PowerShell

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

Page 9: Managing the Infrastructure Stack with PowerShell

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}

Page 10: Managing the Infrastructure Stack with PowerShell

Physical Hardware

Operating System

App

VirtualizationNSXACI

vCenter Server

vRealize Suite

Orchestrator

Operating System

App App

VIOHyper-V

System Center

Orchestrator

Page 11: Managing the Infrastructure Stack with PowerShell

Use CasesWhat to do with this toolbox

Page 12: Managing the Infrastructure Stack with PowerShell

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

Page 13: Managing the Infrastructure Stack with PowerShell

Physical

Operating System

App

VirtualizationVirtual Switch

Uplink

VLANMTU

Ethernet Port

Switch Port

Storage

Adapter

Page 14: Managing the Infrastructure Stack with PowerShell

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}

Page 15: Managing the Infrastructure Stack with PowerShell

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

Page 16: Managing the Infrastructure Stack with PowerShell

PowerActions• Embeds PowerCLI with

vSphere Web Client• Extend web client

capabilities

Page 17: Managing the Infrastructure Stack with PowerShell

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

Page 18: Managing the Infrastructure Stack with PowerShell

Core Challenges• Managing Multiple

Modules/Tools• Relationship Mapping• Scale

Page 19: Managing the Infrastructure Stack with PowerShell

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

Defaults• $home\Documents\

WindowsPowerShell\Modules; $pshome\Modules.

Page 20: Managing the Infrastructure Stack with PowerShell

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

Page 21: Managing the Infrastructure Stack with PowerShell

Physical

Operating System

App

VirtualizationVirtual Switch

Uplink

VLANMTU

Ethernet Port

Switch Port

Adapter

Page 22: Managing the Infrastructure Stack with PowerShell

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

Page 23: Managing the Infrastructure Stack with PowerShell

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}

Page 24: Managing the Infrastructure Stack with PowerShell

Why App DNA?

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

calls.

Page 25: Managing the Infrastructure Stack with PowerShell

Growth Areas• More DSC Resources

• Cisco UCS PowerTool DSC

• Moving away from PSSnapins

Page 26: Managing the Infrastructure Stack with PowerShell

Questions?