GithubHelp home page GithubHelp logo

nvmlabs / packer-windows-plugins Goto Github PK

View Code? Open in Web Editor NEW

This project forked from packer-community/packer-windows-plugins

0.0 2.0 0.0 334 KB

A suite of Packer plugins for provisioning Windows machines

Makefile 0.07% Go 98.75% Shell 1.18%

packer-windows-plugins's Introduction

Packer Windows Plugins

A suite of Packer plugins for provisioning Windows machines using Windows Remote Management.

Status

The plugins are generally available and actively maintained.

wercker status Coverage Status

The Plugins

We have created the following Windows-specific plugins:

Builders

  • VirtualBox ISO and OVF (virtualbox-windows-iso, virtualbox-windows-ovf)
  • VMWare ISO and VMX (vmware-windows-iso, vmware-windows-vmx)
  • Parallels ISO and PVM (parallels-windows-iso, parallels-windows-pvm)
  • Amazon EBS (amazon-windows-ebs)

Provisioners

  • Powershell (powershell)
  • Windows Shell (windows-shell)
  • Restart Windows (restart-windows)

Getting Started

The plugins can be used by downloading pre-built binaries, or by building the project locally and ensuring the binaries are in the correct location.

On Mac OSX using Homebrew

If you are using Homebrew you can follow these steps to install the plugins:

brew install https://raw.githubusercontent.com/packer-community/packer-windows-plugins-brew/master/packer-windows-plugins.rb

On Windows Using Chocolatey

choco install packer-windows-plugins

Using pre-built binaries

  1. Install Packer
  2. Download the latest release for your host environment: packer-windows-plugins/releases
  3. Unzip the plugin binaries to a location where Packer will detect them at run-time, such as any of the following:
  • The directory where the packer binary is.
  • ~/.packer.d/plugins on Unix systems or %APPDATA%/packer.d/plugins on Windows.
  • The current working directory.
  1. Change to a directory where you have packer templates, and run as usual.

Using a local build

With Go 1.2+ installed, follow these steps to use these community plugins for Windows:

  1. Install packer
  2. Clone this repo
  3. Run make dev
  4. Copy the plugin binaries located in ./bin to a location where Packer will detect them at run-time, such as any of the following:
  • The directory where the packer binary is. If you've built Packer locally, then Packer and the new plugins are already in $GOPATH/bin together.
  • ~/.packer.d/plugins on Unix systems or %APPDATA%/packer.d on Windows.
  • The current working directory.
  1. Change to a directory where you have packer templates, and run as usual.

A simple Packer template

A simple Packer template for Windows, which utilizes the virtualbox-windows-iso builder and winrm communicator plugins, will look something like

  {
    "builders": [{
      "type": "virtualbox-windows-iso",
      "vm_name": "windows_2012_r2",
      "iso_url": "iso/en_windows_server_2012_r2_with_update_x64_dvd_4065220.iso",
      "iso_checksum_type": "md5",
      "iso_checksum": "af6a7f966b4c4e31da5bc3cdc3afcbec",
      "guest_os_type": "Windows2012_64",
      "boot_wait": "2m",
      "winrm_username": "packer",
      "winrm_password": "packer",
      "winrm_wait_timeout": "10m",
      "shutdown_timeout": "1h",
      "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
      "disk_size": 61440,
      "format": "ova",
      "floppy_files": [
        "./Autounattend.xml",
        "./enable-winrm.bat",
      ]
    }],
    "provisioners": [{
      "type": "powershell",
      "scripts": [
        "scripts/chocolatey.ps1"
      ]
    },{
      "type": "powershell",
      "inline": [
        "choco install 7zip",
        "choco install dotnet4.5.2"
      ]
    },{
      "type": "windows-shell",
      "scripts": [
        "scripts/netsh.bat"
      ]
    }],
    "post-processors": [{
      "type": "vagrant",
      "output": "windows_2012_r2_virtualbox.box",
      "vagrantfile_template": "Vagrantfile.template"
    }]
  }

Check out these projects for more detailed examples of Windows-centric Packer templates:

Running commands with Elevated privileges

In certain situations, you may need to run commands with elevated privileges even if your winrm_username user is an Administrator, for example upgrading system packages like the .NET Framework. In these cases there are 2 additional keys provided on the powershell provisioner that you can supply that will enable this mode: elevated_user and elevated_password:

{
  "type": "powershell",
  "elevated_user":"vagrant",
  "elevated_password":"vagrant",
  "inline": [
    "choco install netfx-4.5.2-devpack"
  ]
}

Community

  • IRC: #packer-community on Freenode.
  • Slack: packer.slack.com

packer-windows-plugins's People

Contributors

dylanmei avatar mefellows avatar robcoward avatar zl4bv avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.