November 7, 2018 · Exploration

Agility With ChatOps - Software Deployment

The PDQ Deploy logo.

The Problem

Allowing Tier 1 (and "1.5") technicians – who in our environment, are often student workers – the ability and access to deploy our software packages to workstations can be difficult to maintain and can create significant overhead.

We currently make use of PDQ Deploy to install software on our Windows workstations for one-off deployments. We had to manage access to the deployment console, ensure it was installed on our student workers' workstations, and ensure the console software was kept up to date alongside the PDQ Central Server.

PDQ is very easy to use (at least, in comparison to other software deployment tools), but is another tool among many to learn.

The ChatOps Solution

With our discovery of PoshBot, we wondered, could we integrate PDQ Deploy into our daily Slack-based workflows? As it turned out, we could – through the use of PDQ's CLI (Command Line Interface).

For this first post highlighting our use of PoshBot, I'm going to showcase a part of the main function we wrote as a PowerShell module to deploy packages using PDQ Deploy. It's really simple, and really powerful!

function deploy {

[cmdletbinding()]
[PoshBot.BotCommand(
    CommandName = 'deploy',
    Aliases = ('push'),
    Permissions = 'run'
)]
param(
    [Parameter(Position=0)][string]$package,
    [Parameter(Position=1)][string]$target,
)

$pkgpush = pdqdeploy deploy -Package $package -Targets $target | Format-List | Out-String -Width '80'

New-PoshBotCardResponse -Type Normal -Text $pkgpush

PoshBot lives on the server we run as our PDQ Central Server, which allows it to take advantage of the Active Directory service account that PDQ Deploy uses to perform its own deployment tasks.

Credit to Kyle Levenick for help coding & testing the script.

But Does It Work, Really?

It does! (With some caveats.) The command is run like this:

!deploy -package AutoCAD 2019 -target 127.0.0.1

This format seems intuitive – until you realize that the -package parameter is dependent upon knowing the exact names of all of the packages.

This forced us to work on standardizing a package name format (which is, of course, not a bad thing), but was more work than we initially planned.

Please feel free to build on our formatting and improve on our module ideas, and send your feedback my way!