Skip to content

pshamus/packer-provisioner-windows-update

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packer Windows Update Provisioner

Build status Latest version released Package downloads count

This is a Packer plugin for installing Windows updates (akin to rgl/vagrant-windows-update).

NB This was only tested with Packer 1.2.2 and Windows Server 2016.

Usage

Download the binary from the releases page and put it in the same directory as your packer executable.

Use the provisioner from your packer template file, e.g. like in rgl/windows-2016-vagrant:

{
    "provisioners": [
        {
            "type": "windows-update"
        }
    ]
}

Filters

You can select which Windows Updates are installed by defining a set of filters, e.g.:

{
    "provisioners": [
        {
            "type": "windows-update",
            "filters": [
                "exclude:$_.Title -like '*Preview*'",
                "include:$_.Title -like '*Cumulative Update for Windows*'",
                "include:$_.AutoSelectOnWebSites"
            ]
        }
    ]
}

NB If the filters attribute is not declared, only important updates are installed (equivalent of declaring a single include:$_.AutoSelectOnWebSites filter).

The general filter syntax is:

ACTION:EXPRESSION

ACTION is a string that can have one of the following values:

action description
include includes the update when the expression evaluates to $true
exclude excludes the update when the expression evaluates to $true

NB If no ACTION evaluates to $true the update will NOT be installed.

EXPRESSION is a PowerShell expression. When it returns $true, the ACTION is executed and no further filters are evaluated.

Inside an expression, the Windows Update IUpdate interface can be referenced by the $_ variable.

Development

Install the dependencies:

go get -u github.com/hashicorp/packer/packer/plugin
go get -u github.com/masterzen/winrm
go get -u github.com/jteeuwen/go-bindata/...

Build:

make

Configure packer with the path to this provisioner by adding something like the following snippet to your ~/.packerconfig (or %APPDATA%/packer.config):

{
    "provisioners": {
        "windows-update": "/home/rgl/Projects/packer-provisioner-windows-update/packer-provisioner-windows-update"
    }
}

If you are having problems running packer set the PACKER_LOG=1 environment variable to see more information.

About

Packer plugin for installing Windows updates

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 48.0%
  • PowerShell 46.4%
  • Makefile 5.6%