• Stars
    star
    347
  • Rank 122,141 (Top 3 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple PowerShell based deployments

Build status Documentation Status

PSDeploy

PSDeploy is a quick and dirty module to simplify PowerShell based deployments.

The idea is that you write a *.psdeploy.ps1 deployment configuration with sources and targets, and PSDeploy will deploy these.

Suggestions, pull requests, and other contributions would be more than welcome! See the contributing guidlines for more info.

Deployments

Invoking PSDeploy is very similar to running Invoke-Pester. Here's an example, Some.PSDeploy.ps1

Deploy ActiveDirectory1 {                        # Deployment name. This needs to be unique. Call it whatever you want
    By Filesystem {                              # Deployment type. See Get-PSDeploymentType
        FromSource 'Tasks\AD\Some-ADScript.ps1', # One or more sources to deploy. Absolute, or relative to deployment.yml parent
                   'Tasks\AllOfThisDirectory'
        To '\\contoso.org\share$\Tasks'          # One or more destinations to deploy the sources to
        Tagged Prod                              # One or more tags you can use to restrict deployments or queries
        WithOptions @{
            Mirror = $True                       # If the source is a folder, triggers robocopy purge. Danger
        }
    }
}

Let's pretend Some.PSDeploy.ps1 lives in C:\Git\Misc\Deployments. Here's what happens when we invoke a deployment:

Invoke-PSDeploy -Path C:\Git\Misc
  • We search for all *.*Deploy.ps1 or *PSDeploy.ps1 files under C:\Git\Misc, and find Some.PSDeploy.ps1. In this case, we have two resulting deployments, Some-ADScript.ps1, and AllOfThisDirectory
  • We check the deployment type. Filesystem.
  • We invoke the script associated with Filesystem Deployments, passing in the two deployments
  • Relative paths are resolved by joining paths with C:\Git\Misc
  • C:\Git\Misc\Tasks\AD\Some-ADScript.ps1 is copied to \contoso.org\share$\Tasks with Copy-Item
  • C:\Git\Misc\Tasks\AD\Tasks\AllOfThisDirectory is copied to \contoso.org\share$\Tasks with robocopy, using /XO /E /PURGE (we only purge if mirror is true)

Initial PSDeploy setup

# One time setup
    # Download the repository
    # Unblock the zip
    # Extract the PSDeploy folder to a module path (e.g. $env:USERPROFILE\Documents\WindowsPowerShell\Modules\)

    #Simple alternative, if you have PowerShell 5, or the PowerShellGet module:
        Install-Module PSDeploy

# Import the module.
    Import-Module PSDeploy    # Alternatively, Import-Module \\Path\To\PSDeploy

# Get commands in the module
    Get-Command -Module PSDeploy

# Get help for the module and a command
    Get-Help about_PSDeploy
    Get-Help Invoke-PSDeploy -full

More Information

The PSDeploy docs will include more information, including:

  • Examples for different DeploymentTypes - will try to keep these in sync with new types when they are added
  • Illustrations of features like tags and dependencies
  • Common scenarios (todo)
  • How to write new PSDeploy DeploymentTypes
  • Details on the PSDeploy Configuration Files

The blog posts (one, two), and three will become out of date over time, but may include helpful details

Notes

Thanks go to:

  • Scott Muc for PowerYaml, which we borrow for YAML parsing
  • Boe Prox for Get-FileHash, which we borrow for downlevel hash support in the deployment scripts
  • Michael Greene, for the idea of using a DSL similar to Pester
  • Folks writing new PSDeploy deployment types and contributing in other ways - thank you!

More Repositories

1

PowerShell

Various PowerShell functions and scripts
PowerShell
953
star
2

Invoke-Parallel

Speed up PowerShell with simplified multithreading
PowerShell
384
star
3

PSSQLite

PowerShell module to query SQLite databases
PowerShell
309
star
4

PSDepend

PowerShell Dependency Handler
PowerShell
282
star
5

PSSlack

PowerShell module for simple Slack integration
PowerShell
274
star
6

PSExcel

A simple Excel PowerShell module
PowerShell
245
star
7

BuildHelpers

Helper functions for PowerShell CI/CD scenarios
PowerShell
215
star
8

SecretServer

Secret Server PowerShell Module
PowerShell
87
star
9

PSStackExchange

PowerShell module to query Stack Exchange API
PowerShell
81
star
10

PSRabbitMq

PowerShell module to send and receive messages from a RabbitMq server
PowerShell
47
star
11

PSHTMLTable

PowerShell module to spice up ad hoc notifications and reports
PowerShell
38
star
12

Git-Presentation

Presentation materials for Git and GitHub TechSession
34
star
13

WritingModules

Material accompanying PowerShell + DevOps Summit session
PowerShell
32
star
14

PSDiskPart

DiskPart PowerShell Module
PowerShell
32
star
15

Infoblox

Infoblox PowerShell Module
PowerShell
30
star
16

PSNeo4j

Simple Neo4j PowerShell Wrapper
PowerShell
29
star
17

ADGrouper

Define dynamic AD security group membership via yaml
PowerShell
19
star
18

Dots

A janky, neo4j based CMDB glued together with PowerShell
PowerShell
16
star
19

Citrix.NetScaler

PowerShell module for working with Citrix NetScaler REST API
PowerShell
15
star
20

PSRT

PowerShell wrapper for Request Tracker
PowerShell
10
star
21

TireFire

A janky PowerShell module to simplify managing notes and their metadata
PowerShell
7
star
22

PSStash

Atlassian Stash PowerShell Module
PowerShell
7
star
23

PSPagerDuty

Simple PowerShell PagerDuty module
PowerShell
7
star
24

PSLDAPQueryLogging

PowerShell module to simplify configuring AD LDAP diagnostic logging
PowerShell
7
star
25

PSPuppetDB

Simple module for querying the PuppetDB API
PowerShell
6
star
26

CommunityLightningDemos2017

Proposals, and eventually demo material for Community Lightning Demos
PowerShell
6
star
27

Wait-Path

Wait for a path to exist
PowerShell
5
star
28

PSSensu

Simple PowerShell module for working with the Sensu Go API
PowerShell
3
star
29

RamblingCookieMonster.github.io

CSS
3
star
30

SessionMaterials

Materials or links to materials from sessions I've participated in
PowerShell
3
star
31

lisa-kitchen-demo

Example used for Test-Kitchen demo
PowerShell
2
star
32

AppVeyor-DSC-Test

POC to test DSC configurations on a fresh VM from AppVeyor
PowerShell
2
star
33

AppVReporting

App-V Reporting PowerShell Module
PowerShell
2
star
34

zAppVeyor-Explore

PowerShell
1
star
35

wip

Stuff that doesn't have a home yet
PowerShell
1
star